SHA256
1
0
forked from pool/dwz

- Fix assertion failure 'refd != NULL' in write_die [swo#24169].

* dwz-fix-refd-NULL-assertion-in-write_die.patch

OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=24
This commit is contained in:
Tom de Vries 2019-11-28 14:10:53 +00:00 committed by Git OBS Bridge
parent 88b7345e10
commit 9a6297a368
3 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,55 @@
Fix 'refd != NULL' assertion in write_die
[ Backport of master commits 6959430 and 7cc8aae. ]
When running dwz on a file that contains invalid DW_FORM_ref_addr attributes
(which has been observed to be generated by a google go compiler) we run
either into an assert:
...
$ dwz multidictionary
dwz: dwz.c:9461: write_die: Assertion `refd != NULL' failed.
Aborted (core dumped)
...
or a segmentation fault in case of low-mem mode:
...
$ dwz -l0 multidictionary
Segmentation fault (core dumped)
...
Fix this by erroring out instead:
...
$ dwz multidictionary
dwz: Couldn't find DIE at DW_FORM_ref_addr offset 0x97
...
2019-02-05 Tom de Vries <tdevries@suse.de>
PR dwz/24169
* dwz.c (write_die): Error out on invalid DW_FORM_ref_addr.
---
dwz.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dwz.c b/dwz.c
index 928fefa..c7db337 100644
--- a/dwz.c
+++ b/dwz.c
@@ -28,6 +28,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
@@ -9124,6 +9125,9 @@ write_die (unsigned char *ptr, dw_cu_ref cu, dw_die_ref die,
? ptr_size : 4);
inptr += refcu->cu_version == 2 ? ptr_size : 4;
refd = off_htab_lookup (NULL, value);
+ if (refd == NULL || refd->die_tag == 0)
+ error (1, 0, "Couldn't find DIE at DW_FORM_ref_addr offset"
+ " 0x%" PRIx64, value);
assert (refd != NULL);
refdt = refd;
while (refdt->die_toplevel == 0)

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Nov 28 12:56:34 UTC 2019 - Tom de Vries <tdevries@suse.com>
- Fix assertion failure 'refd != NULL' in write_die [swo#24169].
* dwz-fix-refd-NULL-assertion-in-write_die.patch
-------------------------------------------------------------------
Wed Nov 27 18:50:07 UTC 2019 - Tom de Vries <tdevries@suse.com>

View File

@ -76,6 +76,7 @@ NoSource: 0
Patch1: dwz-update-version-copyright-message.patch
Patch2: dwz-fix-die-no-multifile-propagation.patch
Patch3: dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch
Patch4: dwz-fix-refd-NULL-assertion-in-write_die.patch
%if %{build_main}
%description
@ -107,6 +108,7 @@ This package contains the testsuite results from DWZ.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
make %{?_smp_mflags} CFLAGS="%{optflags}"