[newlib-cygwin] Cygwin: Zero out gmon header before use

Jon TURNEY jturney@sourceware.org
Sat Jun 26 14:25:22 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5c9c31c52bfbf41e903eff136cdf894572704e31

commit 5c9c31c52bfbf41e903eff136cdf894572704e31
Author: Mark Geisert <mark@maxrnd.com>
Date:   Wed Jun 23 01:56:14 2021 -0700

    Cygwin: Zero out gmon header before use
    
    Tools that process gmon.out files can be confused by gmon header fields
    with garbage in them due to lack of initialization.  Repair that.

Diff:
---
 winsup/cygwin/gmon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/winsup/cygwin/gmon.c b/winsup/cygwin/gmon.c
index b31842cd9..8b1c449c4 100644
--- a/winsup/cygwin/gmon.c
+++ b/winsup/cygwin/gmon.c
@@ -224,6 +224,7 @@ _mcleanup(void)
 	write(log, dbuf, len);
 #endif
 	hdr = (struct gmonhdr *)&gmonhdr;
+	bzero(hdr, sizeof *hdr);
 	hdr->lpc = p->lowpc;
 	hdr->hpc = p->highpc;
 	hdr->ncnt = p->kcountsize + sizeof(gmonhdr);


More information about the Cygwin-cvs mailing list