Created attachment 1212780 [details] stacktrace Description of problem: During the fuzz of libdwarf I got a memory allocation failure. From the stacktrace seems that the fault is in elfutils. Version-Release number of selected component (if applicable): 0.166 How reproducible: dwarfdump $REPRODUCER
Created attachment 1212781 [details] reproducer
So I assume that the problem is when trying to get the data for the debug_abbrev section, which has a ridiculous big size: [28] .debug_abbrev PROGBITS 0000000000000000 00001223 8000000110 0 0 0 1 The reported memory allocation failure is here: /* We have to read the data from the file. Allocate the needed memory. */ scn->rawdata_base = scn->rawdata.d.d_buf = (char *) malloc (size); if (scn->rawdata.d.d_buf == NULL) { __libelf_seterrno (ELF_E_NOMEM); return 1; } Where size is shdr->sh_size (0x8000000110 == 549755814160) which will obviously fail and the code will return ELF_E_NOMEM.
Thanks for the response. Do you think it needs to be fixed or it is fine as-is?
(In reply to Agostino Sarubbo from comment #3) > Thanks for the response. Do you think it needs to be fixed or it is fine > as-is? In another code path we actually check the size first to make sure the data is all in the file. If the malloc succeeded the code would fail a few lines later anyway when we couldn't read all section data. We could add a sanity check and return ELF_E_INVALID_SECTION_HEADER before even attempting the malloc.
I posted a patch to add that sanity check upstream: https://lists.fedorahosted.org/archives/list/elfutils-devel@lists.fedorahosted.org/message/Q4LE47FPEVRZANMV6JE2NMHYO4H5MHGJ/ Please let me know if that helps your case.
(In reply to Mark Wielaard from comment #5) > I posted a patch to add that sanity check upstream: > https://lists.fedorahosted.org/archives/list/elfutils-devel@lists. > fedorahosted.org/message/Q4LE47FPEVRZANMV6JE2NMHYO4H5MHGJ/ > > Please let me know if that helps your case. I'll retest.
The patch has been pushed upstream now and will be in the next release.
elfutils-0.168-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-0cdc2d3b14
elfutils-0.168-1.fc25 has been pushed to the Fedora 25 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-0cdc2d3b14
elfutils-0.168-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.
elfutils-0.168-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-6c9a495a48
elfutils-0.168-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-2017-6c9a495a48
elfutils-0.168-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
Mitre assigned CVE-2016-10255 to this issue