public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libbacktrace patch committed: Another memcpy -> coff_read4 fix
@ 2018-01-25 16:05 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2018-01-25 16:05 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

This libbacktrace patch fixes another cases where memcpy was used in a
way that would leave some bytes uninitialized on a 64-bit system.
Committed to mainline.

Ian

2018-01-25  Ian Lance Taylor  <iant@golang.org>

* pecoff.c (coff_add): Another memcpy -> coff_read4 fix.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 500 bytes --]

Index: pecoff.c
===================================================================
--- pecoff.c	(revision 257040)
+++ pecoff.c	(working copy)
@@ -631,10 +631,10 @@ coff_add (struct backtrace_state *state,
     goto fail;
 
   {
-    const char *vptr = (const char *)fhdr_view.data;
+    const unsigned char *vptr = fhdr_view.data;
 
     if (vptr[0] == 'M' && vptr[1] == 'Z')
-      memcpy (&fhdr_off, vptr + 0x3c, 4);
+      fhdr_off = coff_read4 (vptr + 0x3c);
     else
       fhdr_off = 0;
   }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-25 15:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 16:05 libbacktrace patch committed: Another memcpy -> coff_read4 fix Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).