diff --git a/PIL/MspImagePlugin.py b/PIL/MspImagePlugin.py index b60a21d69..11d31880c 100644 --- a/PIL/MspImagePlugin.py +++ b/PIL/MspImagePlugin.py @@ -15,7 +15,11 @@ # # See the README file for information on usage and redistribution. # - +# More info on this format: https://archive.org/details/gg243631 +# Page 313: +# Figure 205. Windows Paint Version 1: "DanM" Format +# Figure 206. Windows Paint Version 2: "LinS" Format. Used in Windows V2.03 +# from . import Image, ImageFile from ._binary import i16le as i16, o16le as o16 @@ -92,6 +96,7 @@ def _save(im, fp, filename): # image body ImageFile._save(im, fp, [("raw", (0, 0)+im.size, 32, ("1", 0, 1))]) + # # registry diff --git a/Tests/test_file_msp.py b/Tests/test_file_msp.py index e174d0061..44fc0ec3b 100644 --- a/Tests/test_file_msp.py +++ b/Tests/test_file_msp.py @@ -24,6 +24,15 @@ class TestFileMsp(PillowTestCase): self.assertRaises(SyntaxError, lambda: MspImagePlugin.MspImageFile(invalid_file)) + def test_bad_checksum(self): + # Arrange + # This was created by forcing Pillow to save with checksum=0 + bad_checksum = "Tests/images/hopper_bad_checksum.msp" + + # Act / Assert + self.assertRaises(SyntaxError, + lambda: MspImagePlugin.MspImageFile(bad_checksum)) + def test_open(self): # Arrange # Act