summaryrefslogtreecommitdiffstats
path: root/python/clippy/elf.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:56:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:56:23 +0000
commitc15d6efd40655f717841d00839a43df1ead5cb26 (patch)
tree35d579f9a19170e2b39085669ca92533c2d161b4 /python/clippy/elf.py
parentAdding upstream version 10.0.1. (diff)
downloadfrr-upstream.tar.xz
frr-upstream.zip
Adding upstream version 10.1.upstream/10.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'python/clippy/elf.py')
-rw-r--r--python/clippy/elf.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/python/clippy/elf.py b/python/clippy/elf.py
index cc442ee..fd34842 100644
--- a/python/clippy/elf.py
+++ b/python/clippy/elf.py
@@ -458,7 +458,16 @@ class ELFSubset(object):
- `this[123:str]` - extract until null byte. The slice stop value is
the `str` type (or, technically, `unicode`.)
"""
- return self._obj[k]
+ if k.start < getattr(self._obj, "len", float("+Inf")):
+ return self._obj[k]
+
+ real_sect = self._elffile.get_section_addr(self._obj.sh_addr + k.start)
+ offs = self._obj.sh_addr - real_sect.sh_addr
+ if k.stop is str:
+ new_k = slice(k.start + offs, str)
+ else:
+ new_k = slice(k.start + offs, k.stop + offs)
+ return real_sect[new_k]
def getreloc(self, offset):
"""