From ac83b2dfe4504babfbafc5efb37dbde4bed34fed Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 11 Feb 2017 11:55:11 +0200 Subject: [PATCH] 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) --- src/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/image.c b/src/image.c index a7a94165282..1e8ebfd40d5 100644 --- a/src/image.c +++ b/src/image.c @@ -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]); } -- 2.39.2