Bug 1330237

Summary: NULL dereference bug in _dwarf_decode_s_leb128
Product: [Fedora] Fedora Reporter: lieanu <liuyue0310>
Component: libdwarfAssignee: Tom Hughes <tom>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: orion, tom
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libdwarf-20160507-1.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 16:13:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
bad elf that trigger this bug none

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             }
 916
 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;
 922


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.