This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix BZ 20419 -- stack overflow with huge PT_NOTE segment


On Thu, May 3, 2018 at 10:08 AM Siddhesh Poyarekar <siddhesh@gotplt.org>
wrote:


> Patch is OK but please add a detailed description of the problem in your
> git commit message; it should ideally be part of the submission.

+                   abi_note_malloced = abi_note = malloc (size);
+                   if (abi_note == NULL)
+                     goto read_error;

I noticed that this could leak memory for a DSO with multiple PT_NOTEs
(which LLD used to produce until that bug was fixed).

Changed this part to:

+                   /* There could be multiple PT_NOTEs.  */
+                   abi_note_malloced = realloc (abi_note_malloced, size);
+                   if (abi_note_malloced == NULL)
+                     goto read_error;
+
+                   abi_note = abi_note_malloced;

and committed.

Thanks,
-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]