diff options
Diffstat (limited to 'python/clippy')
-rw-r--r-- | python/clippy/__init__.py | 1 | ||||
-rw-r--r-- | python/clippy/elf.py | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/python/clippy/__init__.py b/python/clippy/__init__.py index 60119fb..668724a 100644 --- a/python/clippy/__init__.py +++ b/python/clippy/__init__.py @@ -20,6 +20,7 @@ from _clippy import ( CMD_ATTR_HIDDEN, CMD_ATTR_DEPRECATED, CMD_ATTR_NOSH, + elf_notes, ) 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): """ |