Fix handling of XBM images on MS-Windows

* src/image.c (xbm_load) [HAVE_NTGUI]: Fix calculation of
'nbytes' when inverting XBM data bits.  (Bug#25661)
This commit is contained in:
Eli Zaretskii 2017-02-11 11:55:11 +02:00
parent 09d5083420
commit ac83b2dfe4

View 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]);
}