]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix handling of XBM images on MS-Windows
authorEli Zaretskii <eliz@gnu.org>
Sat, 11 Feb 2017 09:55:11 +0000 (11:55 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 11 Feb 2017 09:55:11 +0000 (11:55 +0200)
* src/image.c (xbm_load) [HAVE_NTGUI]: Fix calculation of
'nbytes' when inverting XBM data bits.  (Bug#25661)

src/image.c

index a7a94165282cd9f72e6285d17f2d4884757a1147..1e8ebfd40d57f6790670bda13315f156770d76c5 100644 (file)
@@ -3110,8 +3110,8 @@ xbm_load (struct frame *f, struct image *img)
             int nbytes, i;
             /* Windows mono bitmaps are reversed compared with X.  */
             invertedBits = bits;
-            nbytes = (img->width + CHAR_BIT - 1) / CHAR_BIT;
-            SAFE_NALLOCA (bits, nbytes, img->height);
+            nbytes = (img->width + CHAR_BIT - 1) / CHAR_BIT * img->height;
+            SAFE_NALLOCA (bits, 1, nbytes);
             for (i = 0; i < nbytes; i++)
               bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]);
           }