From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45650 invoked by alias); 28 Nov 2019 09:04:43 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 45609 invoked by uid 89); 28 Nov 2019 09:04:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=google X-Spam-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Fix 'refd != NULL' assertion in write_die Message-ID: <20191128090436.GA16198@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-q4/txt/msg00089.txt.bz2 Hi, 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 ... Committed to trunk. Thanks, - Tom Fix 'refd != NULL' assertion in write_die 2019-02-05 Tom de Vries 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 e26b02e..5cf05f8 100644 --- a/dwz.c +++ b/dwz.c @@ -9458,6 +9458,10 @@ 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%lx", + value); assert (refd != NULL); refdt = refd; while (refdt->die_toplevel == 0)