Bug 1330237 - NULL dereference bug in _dwarf_decode_s_leb128
Summary: NULL dereference bug in _dwarf_decode_s_leb128
Alias: None
Product: Fedora
Classification: Fedora
Component: libdwarf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Tom Hughes
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2016-04-25 17:18 UTC by lieanu
Modified: 2016-05-12 16:13 UTC (History)
2 users (show)

Fixed In Version: libdwarf-20160507-1.fc24
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-05-12 16:13:54 UTC
Type: Bug

Attachments (Terms of Use)
bad elf that trigger this bug (206.45 KB, application/x-gzip)
2016-04-25 17:18 UTC, lieanu
no flags Details

Description lieanu 2016-04-25 17:18:16 UTC
Created attachment 1150561 [details]
bad elf that trigger this bug

Description of problem:
There is a NULL pointer dereference bug in libdwarf-20160115 and latest git code.

The bug is at file dwarf_leb.c:147
 143             byte_length++;
 144             if (byte_length > BYTESLEBMAX) {
 145                 /*  Erroneous input. What to do?
 146                     Abort? Return error? Just stop here?*/
 147                 *leb128_length = BYTESLEBMAX;               <- $pc
 148                 return number;
 149             }
 150         }

which triggered by dwarf_form.c:918
 913             *return_sval = (Dwarf_Signed) ret_value;
 914             return DW_DLV_OK;
 915             }
 917         case DW_FORM_sdata:
 918             ret_value =
 919                 (_dwarf_decode_s_leb128(attr->ar_debug_ptr, NULL));
 920             *return_sval = ret_value;
 921             return DW_DLV_OK;

Version-Release number of selected component (if applicable):
Tested in libdwarf-20160115 and latest git code

How reproducible:
Use the attachment:
$ dwarfdump <extracted attachment>

Actual results:
Segmentation Fault

Comment 1 Tom Hughes 2016-04-25 18:11:56 UTC
Has this been reported upstream?

Comment 2 lieanu 2016-04-25 18:19:05 UTC
No, it has been reported for the first time.

Comment 3 Tom Hughes 2016-04-25 18:26:37 UTC
It would be far better if you reported bug which you clearly know are not Fedora specific (because you say you have checked against git) directly to upstream rather than reporting them here and making me forward them all for you...

Comment 4 Tom Hughes 2016-04-25 18:29:22 UTC
I've informed upstream of the problem now.

Comment 5 lieanu 2016-04-26 15:22:20 UTC
Thanks, but how can I report the bugs directly to the upstream's maillist?
Is this one: libdwarf-list ? How can I subscribe to this maillist?

Comment 6 Tom Hughes 2016-04-26 15:24:12 UTC
It's not actually a list (or if it is then that's just an internal detail) and you can send mail to that address without subscribing.

Comment 7 Fedora Update System 2016-05-08 10:27:33 UTC
libdwarf-20160507-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f36c5935e5

Comment 8 Fedora Update System 2016-05-09 00:55:08 UTC
libdwarf-20160507-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f36c5935e5

Comment 9 Fedora Update System 2016-05-12 16:13:16 UTC
libdwarf-20160507-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.