aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoj Gupta <manojgupta@chromium.org>2021-11-01 11:23:22 -0700
committerMike Frysinger <vapier@gentoo.org>2022-09-28 13:27:14 +0545
commit413a60a31daafe60a539fc113dafb1760abb1d20 (patch)
tree5c10285e8a8f69ff06e0f3b2cc5b6ccca6c9ed18
parentlddtree: specify utf-8 encoding with text files (diff)
downloadpax-utils-413a60a31daafe60a539fc113dafb1760abb1d20.tar.gz
pax-utils-413a60a31daafe60a539fc113dafb1760abb1d20.tar.bz2
pax-utils-413a60a31daafe60a539fc113dafb1760abb1d20.zip
lddtree: Add logging for ELFParseError
Add logging inside parseELF to print the bad file if the parser fails with ELFParseError. Bug: https://issuetracker.google.com/issues/203821449 Signed-off-by: Manoj Gupta <manojgupta@chromium.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rwxr-xr-xlddtree.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lddtree.py b/lddtree.py
index 3c9d66f..349bace 100755
--- a/lddtree.py
+++ b/lddtree.py
@@ -432,7 +432,11 @@ def ParseELF(path, root='/', cwd=None, prefix='',
dbg(debug, 'ParseELF(%s)' % path)
with open(path, 'rb') as f:
- elf = ELFFile(f)
+ try:
+ elf = ELFFile(f)
+ except exceptions.ELFParseError:
+ warn("ELFParser failed to parse", path)
+ raise
# If this is the first ELF, extract the interpreter.
if _first: