]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix ASAN error with fringe bitmap on NS
authorAndreas Schwab <schwab@linux-m68k.org>
Fri, 15 Jul 2022 15:24:19 +0000 (17:24 +0200)
committerAndreas Schwab <schwab@linux-m68k.org>
Fri, 15 Jul 2022 15:26:39 +0000 (17:26 +0200)
* src/nsterm.m (ns_define_fringe_bitmap): Correctly access fringe
bitmap data.  (Bug#56553)

src/nsterm.m

index 582bc9f6a2d086f54fcd6ebd96fcf66852a4f83f..57f1f44de26415de36162a5725d9cec3e7622343 100644 (file)
@@ -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)];
       }