public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug libdw/23301] free on unitialized value
       [not found] <bug-23301-1403@http.sourceware.org/bugzilla/>
@ 2018-06-17 18:30 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2018-06-17 18:30 UTC (permalink / raw)
  To: Luiz Angelo Daros de Luca; +Cc: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=23301

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2018-06-17
                 CC|                            |mark at klomp dot org
           Assignee|unassigned at sourceware dot org   |mark at klomp dot org
     Ever confirmed|0                           |1

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 11076
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11076&action=edit
libdw: Initialize filelist earlier in dwarf_getsrclines.c read_srclines.

Hi,

gcc is wrong, filelist will not be used/freed if nfilelist == 0, and filelist
will be initialized if nfilelist != 0. But this might be hard to see for the
compiler. BTW which gcc version is this, any special CFLAGS used?

Instead of moving the whole block of code around I think just explicitly
setting filelist to NULL when we initialize nfilelist = 0 should do the trick.

Could you test the slightly changed patch attached?

Also would it me OK to add a Signed-off-by: Luiz Angelo Daros de Luca 
<luizluca@gmail.com> line as described in
https://sourceware.org/git/?p=elfutils.git;a=blob_plain;f=CONTRIBUTING;hb=HEAD

Thanks,

Mark

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libdw/23301] free on unitialized value
  2018-06-17  8:45 [Bug libdw/23301] New: " luizluca at gmail dot com
@ 2018-06-18 11:32 ` mark at klomp dot org
  0 siblings, 0 replies; 2+ messages in thread
From: mark at klomp dot org @ 2018-06-18 11:32 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=23301

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2018-06-17
                 CC|                            |mark at klomp dot org
           Assignee|unassigned at sourceware dot org   |mark at klomp dot org
     Ever confirmed|0                           |1
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 11076
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11076&action=edit
libdw: Initialize filelist earlier in dwarf_getsrclines.c read_srclines.

Hi,

gcc is wrong, filelist will not be used/freed if nfilelist == 0, and filelist
will be initialized if nfilelist != 0. But this might be hard to see for the
compiler. BTW which gcc version is this, any special CFLAGS used?

Instead of moving the whole block of code around I think just explicitly
setting filelist to NULL when we initialize nfilelist = 0 should do the trick.

Could you test the slightly changed patch attached?

Also would it me OK to add a Signed-off-by: Luiz Angelo Daros de Luca 
<luizluca@gmail.com> line as described in
https://sourceware.org/git/?p=elfutils.git;a=blob_plain;f=CONTRIBUTING;hb=HEAD

Thanks,

Mark

--- Comment #2 from Luiz Angelo Daros de Luca <luizluca at gmail dot com> ---
Mark,

It works. Gcc does not blame me anymore.

Thanks.

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
commit 9e16a100bf8e0d43415253fe8cfd3ba1d8e637d1
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Date:   Sun Jun 17 11:34:08 2018 +0200

    libdw: Initialize filelist earlier in dwarf_getsrclines.c read_srclines.

    I'm getting this error with 0.172:

    dwarf_getsrclines.c: In function 'read_srclines':
    dwarf_getsrclines.c:1074:7: error: 'filelist' may be used uninitialized in
t
           free (filelist);
           ^~~~~~~~~~~~~~~

    It seems that gcc is right here as there is "ifs" that go to "out"
    (where filelist is freed) before freelist is initialized.

    Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-18 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23301-1403@http.sourceware.org/bugzilla/>
2018-06-17 18:30 ` [Bug libdw/23301] free on unitialized value Mark Wielaard
2018-06-17  8:45 [Bug libdw/23301] New: " luizluca at gmail dot com
2018-06-18 11:32 ` [Bug libdw/23301] " mark at klomp dot org

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).