From: Seva Alekseyev Date: Wed, 23 Aug 2023 14:32:24 +0000 (-0400) Subject: Friendly error in get_location_list_at_offset (#492) X-Git-Tag: v0.30~3 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c4a20fbbe244c33c0a030d91a36d91a06eec0f69;p=pyelftools.git Friendly error in get_location_list_at_offset (#492) --- diff --git a/elftools/dwarf/locationlists.py b/elftools/dwarf/locationlists.py index 243834f..9a34977 100644 --- a/elftools/dwarf/locationlists.py +++ b/elftools/dwarf/locationlists.py @@ -92,6 +92,8 @@ class LocationLists(object): Passing the die is only neccessary in DWARF5+, for decoding location entry encodings that contain references to other sections. """ + if self.version >= 5 and die is None: + raise DWARFError("For this binary, \"die\" needs to be provided") self.stream.seek(offset, os.SEEK_SET) return self._parse_location_list_from_stream_v5(die.cu) if self.version >= 5 else self._parse_location_list_from_stream()