commit: 413a60a31daafe60a539fc113dafb1760abb1d20 Author: Manoj Gupta <manojgupta <AT> chromium <DOT> org> AuthorDate: Mon Nov 1 18:23:22 2021 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> CommitDate: Wed Sep 28 07:42:14 2022 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=413a60a3
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 <AT> chromium.org> Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> lddtree.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: