public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [PATCH] Error out on empty debug section
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190307070510.GA19866@delia> (raw)

Hi,

When encountering an empty debug section, we run into the following assert:
...
dwz: dwz.c:9901: read_dwarf: Assertion `data != NULL && data->d_buf != NULL' \
  failed.
...

Error out instead:
...
dwz: a.out: Found empty .debug_gdb_scripts section, not attempting dwz \
  compression
...

OK for trunk?

Thanks,
- Tom

Error out on empty debug section

2019-02-14  Tom de Vries  <tdevries@suse.de>

	PR dwz/24173
	* dwz.c (read_dwarf): Change assert (data->d_buf != NULL) into an error.

---
 dwz.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dwz.c b/dwz.c
index 4ef8657..fc87abe 100644
--- a/dwz.c
+++ b/dwz.c
@@ -9906,7 +9906,13 @@ read_dwarf (DSO *dso, bool quieter)
 
 		  scn = dso->scn[i];
 		  data = elf_rawdata (scn, NULL);
-		  assert (data != NULL && data->d_buf != NULL);
+		  assert (data != NULL);
+		  if (data->d_buf == NULL)
+		    {
+		      error (0, 0, "%s: Found empty %s section, not attempting"
+			     " dwz compression", dso->filename, name);
+		      return 1;
+		    }
 		  assert (elf_rawdata (scn, data) == NULL);
 		  assert (data->d_off == 0);
 		  assert (data->d_size == dso->shdr[i].sh_size);

             reply	other threads:[~2019-03-07  7:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01  0:00 Tom de Vries [this message]
2019-01-01  0:00 ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190307070510.GA19866@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).