1 |
commit: 413a60a31daafe60a539fc113dafb1760abb1d20 |
2 |
Author: Manoj Gupta <manojgupta <AT> chromium <DOT> org> |
3 |
AuthorDate: Mon Nov 1 18:23:22 2021 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 28 07:42:14 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=413a60a3 |
7 |
|
8 |
lddtree: Add logging for ELFParseError |
9 |
|
10 |
Add logging inside parseELF to print the bad file if the parser |
11 |
fails with ELFParseError. |
12 |
|
13 |
Bug: https://issuetracker.google.com/issues/203821449 |
14 |
Signed-off-by: Manoj Gupta <manojgupta <AT> chromium.org> |
15 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
16 |
|
17 |
lddtree.py | 6 +++++- |
18 |
1 file changed, 5 insertions(+), 1 deletion(-) |
19 |
|
20 |
diff --git a/lddtree.py b/lddtree.py |
21 |
index 3c9d66f..349bace 100755 |
22 |
--- a/lddtree.py |
23 |
+++ b/lddtree.py |
24 |
@@ -432,7 +432,11 @@ def ParseELF(path, root='/', cwd=None, prefix='', |
25 |
dbg(debug, 'ParseELF(%s)' % path) |
26 |
|
27 |
with open(path, 'rb') as f: |
28 |
- elf = ELFFile(f) |
29 |
+ try: |
30 |
+ elf = ELFFile(f) |
31 |
+ except exceptions.ELFParseError: |
32 |
+ warn("ELFParser failed to parse", path) |
33 |
+ raise |
34 |
|
35 |
# If this is the first ELF, extract the interpreter. |
36 |
if _first: |