erroneous substitution in Readelf.filter
Example: https://try.diffoscope.org/kcxgqqsavzqh.txt
There is an erroneous replacement of a/
with /
in this output, causing a diff that doesn't actually exist:
--- a/libglide-webp.so
+++ b/libglide-webp.so
[...]
│ - 0x0005ddd0 612f6c61 6e672f49 6c6c6567 616c5374 /lang/IllegalSt
│ + 0x0005ddd0 612f6c61 6e672f49 6c6c6567 616c5374 a/lang/IllegalSt
│ 0x0005dde0 61746545 78636570 74696f6e 006a6176 ateException.jav
│ - 0x0005ddf0 612f6c61 6e672f4f 75744f66 4d656d6f /lang/OutOfMemo
│ + 0x0005ddf0 612f6c61 6e672f4f 75744f66 4d656d6f a/lang/OutOfMemo
Caused by this code which is meant to replace the (dirname of the) path of the .so
file, but in this case happens to match an unrelated a/
occurring in the hex dump output:
class Readelf(Command):
def __init__(self, *args, **kwargs):
[...]
self._path_re = re.compile(
r"\b%s/\b" % re.escape(os.path.dirname(self.path))
)
[...]
def filter(self, line):
[...]
# the full path can appear in the output, we need to remove it
val = self._path_re.sub("/", val)
I'm not sure what the best fix for this is as I don't know all the output formats this handles or when the path is expected to appear in the output when it does need removal. Not performing the substitution when the line starts with 0x
would be a simple fix for this case but could break others.
Edit: the files: libglide-webp.so libglide-webp.so
Edited by FC (Fay) Stegerman