From 889943e2bd5668335649b064b10b70a15c17c189 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 15 Jul 2022 17:24:19 +0200 Subject: [PATCH] Fix ASAN error with fringe bitmap on NS * src/nsterm.m (ns_define_fringe_bitmap): Correctly access fringe bitmap data. (Bug#56553) --- src/nsterm.m | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index 582bc9f6a2d..57f1f44de26 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2900,10 +2900,7 @@ ns_define_fringe_bitmap (int which, unsigned short *bits, int h, int w) for (int y = 0 ; y < h ; y++) for (int x = 0 ; x < w ; x++) { - /* XBM rows are always round numbers of bytes, with any unused - bits ignored. */ - int byte = y * (w/8 + (w%8 ? 1 : 0)) + x/8; - bool bit = bits[byte] & (0x80 >> x%8); + bool bit = bits[y] & (1 << (w - x - 1)); if (bit) [p appendBezierPathWithRect:NSMakeRect (x, y, 1, 1)]; } -- 2.39.2