GraphicsMagick: coders/bmp.c: 64 bytes for BMP header is reserve...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.8054.1691589767.1439.graphicsmagick-commit@lists.sourceforge.net>
changeset ce684ca1ae8e in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=ce684ca1ae8e
summary: coders/bmp.c: 64 bytes for BMP header is reserved for OS/2

diffstat:

 ChangeLog    |  5 +++++
 coders/bmp.c |  6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r 4b2b1c4ecfda -r ce684ca1ae8e ChangeLog
--- a/ChangeLog	Tue Aug 08 15:38:59 2023 -0500
+++ b/ChangeLog	Wed Aug 09 16:02:19 2023 +0200
@@ -1,3 +1,8 @@
+2023-08-09  Fojtik Jaroslav  <[email protected]>
+
+	* coders/bmp.c: 64 bytes for BMP header is reserved for OS/2
+	https://www.fileformat.info/format/os2bmp/egff.htm
+
 2023-08-08  Bob Friesenhahn  <[email protected]>
 
 	* coders/bmp.c (ReadBMPImage): Re-indent/format for consistency.
diff -r 4b2b1c4ecfda -r ce684ca1ae8e coders/bmp.c
--- a/coders/bmp.c	Tue Aug 08 15:38:59 2023 -0500
+++ b/coders/bmp.c	Wed Aug 09 16:02:19 2023 +0200
@@ -678,7 +678,7 @@
       if (LocaleNCompare((char *) magick,"BM",2) != 0)  /* "BM" is Windows or OS/2 file. */
         {
           if ((LocaleNCompare((char *) magick,"CI",2) != 0) ||  /* "CI" is OS/2 Color Icon */
-              (bmp_info.size!=12 && bmp_info.size!=40)) /* CI chunk must have biSize only 12 or 40 */
+              (bmp_info.size!=12 && bmp_info.size!=40 && bmp_info.size!=64)) /* CI chunk must have biSize only 12 or 40 or 64 */
             ThrowBMPReaderException(CorruptImageError,ImproperImageHeader,image);
         }
 
@@ -725,7 +725,7 @@
             case 56:
             case 78:
             case 108: break;
-            default: if (bmp_info.size <= 64)
+            default: if (bmp_info.size < 64)
                 ThrowBMPReaderException(CorruptImageError, NonOS2HeaderSizeError, image);
               break;
             }
@@ -813,7 +813,7 @@
                                     "  Important colors: %u",bmp_info.colors_important);
             }
 
-          if (bmp_info.size >= 52)
+          if (bmp_info.size >= 52 && bmp_info.size!=64)
             {
               bmp_info.red_mask=ReadBlobLSBLong(image);
               bmp_info.green_mask=ReadBlobLSBLong(image);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.