Subject: bug#37756: closed (Re: bug#37756: [PATCH] Wrong initialization of fringe bitmap)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 26 Oct 2019 10:22:02 +0000

Your bug report

#37756: [PATCH] Wrong initialization of fringe bitmap

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
37756: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37756
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#37756: [PATCH] Wrong initialization of fringe bitmap
From: Eli Zaretskii <[email-masked]>
To: Carlos Pita <[email-masked]>
Cc: [email-masked]
Date: Sat, 26 Oct 2019 13:21:25 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Carlos Pita <[email-masked]>
> Date: Wed, 16 Oct 2019 17:01:11 -0300
> Cc: [email-masked]
> 
> I'm having some issues doing that because I'm using magit to amend /
> reword previously committed changes, so the instructions there don't
> quite match my situation. Will try harder later, for now I just
> modified the message after some examples in your git log. Hope it's ok
> now.

Thanks, pushed.  Closing the bug.

> From: memeplex <[email-masked]>
        ^^^^^^^^
Is this really how you want your name to appear in the Git log?

Subject: [PATCH] Wrong initialization of fringe bitmap
From: Carlos Pita <[email-masked]>
To: [email-masked]
Date: Mon, 14 Oct 2019 23:39:19 -0300
List-Id: <debbugs-submit.debbugs.gnu.org>

In fringe.c:1606 you have:

  xfb = xmalloc (sizeof fb + fb.height * BYTES_PER_BITMAP_ROW);
  fb.bits = b = ((unsigned short *)
ptr_bounds_clip (xfb + 1, fb.height * BYTES_PER_BITMAP_ROW));
  xfb = ptr_bounds_clip (xfb, sizeof *xfb);
  memset (b, 0, fb.height);

I might be wrong but it seems to me that the last line should be:

  memset (b, 0, fb.height * BYTES_PER_BITMAP_ROW);

instead.

I've attached a patch that does exactly that.

Best regards
--
Carlos
From fe3f040d6614ee4b990f3f4252c89d9a17c52845 Mon Sep 17 00:00:00 2001
From: memeplex <[email-masked]>
Date: Mon, 14 Oct 2019 23:33:37 -0300
Subject: [PATCH] Fix zero initialization of fringe bitmap

* src/fringe.c: the size in bytes of fb.bits is
    fb.height * BYTES_PER_BITMAP_ROW
  and not simply the number of rows fb.height.
---
 src/fringe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/fringe.c b/src/fringe.c
index 22f3bdc..db91209 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1607,7 +1607,7 @@ list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap
   fb.bits = b = ((unsigned short *)
 		 ptr_bounds_clip (xfb + 1, fb.height * BYTES_PER_BITMAP_ROW));
   xfb = ptr_bounds_clip (xfb, sizeof *xfb);
-  memset (b, 0, fb.height);
+  memset (b, 0, fb.height * BYTES_PER_BITMAP_ROW);
 
   j = 0;
   while (j < fb.height)
-- 
2.20.1