We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5d52ede + ae6bb4c commit 952d6e9Copy full SHA for 952d6e9
Tests/test_file_ftex.py
@@ -1,5 +1,8 @@
1
from __future__ import annotations
2
3
+import io
4
+import struct
5
+
6
import pytest
7
8
from PIL import FtexImagePlugin, Image
@@ -23,3 +26,15 @@ def test_invalid_file() -> None:
23
26
24
27
with pytest.raises(SyntaxError):
25
28
FtexImagePlugin.FtexImageFile(invalid_file)
29
30
31
+def test_invalid_texture() -> None:
32
+ with open("Tests/images/ftex_dxt1.ftc", "rb") as fp:
33
+ data = fp.read()
34
35
+ # Change texture compression format
36
+ data = data[:24] + struct.pack("<i", 2) + data[28:]
37
38
+ with pytest.raises(ValueError, match="Invalid texture compression format: 2"):
39
+ with Image.open(io.BytesIO(data)):
40
+ pass
0 commit comments