From 4354fa540290f0d291c0bce16d688ef5191b468a Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 15 Aug 2020 21:43:49 +1000 Subject: [PATCH] Moved CVE images into password-protected zip --- Tests/check_tiff_crashes.py | 26 ++++++++++++++++++-------- Tests/images/crash.zip | Bin 0 -> 1902 bytes Tests/images/crash_1.tif | Bin 6511 -> 0 bytes Tests/images/crash_2.tif | Bin 6223 -> 0 bytes 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 Tests/images/crash.zip delete mode 100644 Tests/images/crash_1.tif delete mode 100644 Tests/images/crash_2.tif diff --git a/Tests/check_tiff_crashes.py b/Tests/check_tiff_crashes.py index f4eb0437514..33b9c87701e 100644 --- a/Tests/check_tiff_crashes.py +++ b/Tests/check_tiff_crashes.py @@ -14,16 +14,26 @@ # version. +import io +import zipfile + from PIL import Image +# The vulnerabilities represented by these files have been addressed. +# However, antivirus software does not detect that this is a version of Pillow +# with those fixes, and so to prevent unnecessary alarm, the files are +# hidden inside a password-protected zip repro_read_strip = ( - "images/crash_1.tif", - "images/crash_2.tif", + "crash_1.tif", + "crash_2.tif", ) -for path in repro_read_strip: - with Image.open(path) as im: - try: - im.load() - except Exception as msg: - print(msg) +with zipfile.ZipFile("images/crash.zip") as crashzip: + for path in repro_read_strip: + with crashzip.open(path, pwd=b"vulnerabilitiesaddressed") as f: + data = io.BytesIO(f.read()) + with Image.open(data) as im: + try: + im.load() + except Exception as msg: + print(msg) diff --git a/Tests/images/crash.zip b/Tests/images/crash.zip new file mode 100644 index 0000000000000000000000000000000000000000..c2c9afb91ff6a316d1dfb0604f2e6daa14fdc632 GIT binary patch literal 1902 zcmZ|QX*|^19|!QCb&M(d*axXU6AFW?v5zLaaK~DtFxMKgjdI7$nwZdHt(aurhQg4o zP{vqu?Fkd<4z6vev4{EVfA0g`|LdOf;GFZ|e7=v~uaC6_2d4-C26%wW<@`3jY~k$t z>;Mob0RRv{8gR$`5^~K|{p<}NuZ#9zfFrC!+f}$z+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7MmOG!<=lPTxulWE^de68TMun3U^sKam+nx#N`yCdDWNO~u6 zQl*bRUSI(>x-tE8^#W!Q8`Q$9XG2~LG>gQal5IkqDrcy%-0`KqmcdOYQ7N>!eS)?z zVKkwLzoE#!Mz%qUT6%{enle^wW3v5vG7SmZCuT7Oep^mz|0BWYDU^IdHl)*VyukmF zCN17dU!C%RFtp|9n%h6|rCI|uMrPC!Fx695$a&;t>|=aJmg*5fWApm=nFo#hkO-JMOJycw|@e^d;#5j0n4lXHWHJQn#BjPgKntOMLrYrw&HyB zQ<5(Iwz4m{23iPbVLgWlaQ)k(@x?7`ZSnIajrZ!w&YdJVdHBOT%@CsB31y{W4AX2x z?+YD3Z8CY*pd(Fl*;n^5SV53AQ@aN$Fd-x$P`O?`l|Et^L1Bea?u?JV;pX|W`(cDv z2=(3AQAySoZ0s@||JGZF)c#(DG2bsgv>4Z4E%uKF`)ATT}o5 literal 0 HcmV?d00001 diff --git a/Tests/images/crash_1.tif b/Tests/images/crash_1.tif deleted file mode 100644 index 230d4439aadb0867d3005e6cec458b69588ecc42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6511 zcmebD)M7AVWMHV6(|g&_`>=xu`-lHenXc<+*sg58(KBmF8RG(#Cix`+_6-)6DHftj zn&l7jKaz+#xPIbA!=}y8@3wB6{ypl&?N7?z|LN;06e#@g8$?4B4L z>-8vd@8*uFRg0I^J<;Ck81HiB+@w9&fVg9BO=v>V?z{z^wa?ESiO|tqd2%-+GXv0Z z3^Re45yS>bfW%n^4sJY}@9cYKzgEf-qmPZ8C)Zwl&=Qfhd#*9_uOoMMmh`J0`40gM z7AmP))wR;)9*6bz@#Lg%mYqC3moxaFbXnRfGs_Ku{8xgm^Xx3+?lqrSYVDoyEqCWM zwnpBE`vS^~1)pj8&tRV>WgmaMCy)QzwcFa>vbV1=F5X>GR@IYw;HaGT4o=@(CeM?6 z$KB5JZ(Qe79ck_I$K3sh+Qwu3PF26zlUKMiFbFXGV_*S$1LzB&KbRSqe*XWT26Wv& zsQ1jVSi*qSmW}+?=Y7_p+Jfu~h&*8rl*2s$3f@f(K!OeEL}pUL62n_4F$FZyoPoiJ zfq@C?Nsufvlue$6JURYAGr$qJ2oZsQ7$cCP@H{YB4T+9NP%u!(p><>dd}(x;c#+s} zDF-RU$g6}h;y_0rvAzSV!|)xrB*K~H&d2@br+X4}sx=9Aeve+084d>RJDUDY4kc8VhFh;q!vdhiO}rB-Y6IV zr;_7EoV{AI8hW5ON9)y6si6ms1}v31X5$Jec2F96NGSuaCTvLvtN|3Gz!c~J#Ntp( zn1O65MphunFxrsBHLfzG8kP4!!V&sa~)*Fs4@Tm diff --git a/Tests/images/crash_2.tif b/Tests/images/crash_2.tif deleted file mode 100644 index 26c00d0ff1ae8610df40faf6e38cf41afff596d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6223 zcmebD)M7AVWMHV6(|g&_`>=xu`-lHenXc<+*sg58(KBmF8RG(#Cix`+_6-)6DHftj zn&l7jKaz+#xPIbA!=}y8@3wB6{ypl&?N7?z|LN;06e#@g8$?4B4L z>-8vd@8*uFRg0I^J<;Ck81HiB+@w9&fVg9BO=v>V?z{z^wa?ESiO|tqd2%-+GXv0Z z3^Re45yS>bfW%n^4sJY}@9cYKzgEf-qmPZ8C)Zwl&=Qfhd#*9_uOoMMmh`J0`40gM z7AmP))wR;)9*6bz@#Lg%mYqC3moxaFbXnRfGs_Ku{8xgm^Xx3+?lqrSYVDoyEqCWM zwnpBE`vS^~1)pj8&tRV>WgmaMCy)QzwcFa>vbV1=F5X>GR@IYw;HaGT4o=@(CeM?6 z$KB5JZ(Qe79ck_I$K3sh+Qwu3PF26zlUKMiFbFXGV_*S$1LzB&KbRSqe*XWT26Wv& zsQ1jVSi*qSmW}+?=Y7_p+Jfu~h&*8rl*2s$3f@f(K!OeEL}pUL62n_4F$FZyoPoiJ zfq@C?Nsufvlue$6(8ybah`c|H5lGQ@9vGyCM8_d02&m)8I@$y5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