From c4a20fbbe244c33c0a030d91a36d91a06eec0f69 Mon Sep 17 00:00:00 2001 From: Seva Alekseyev Date: Wed, 23 Aug 2023 10:32:24 -0400 Subject: [PATCH] Friendly error in get_location_list_at_offset (#492) --- elftools/dwarf/locationlists.py | 2 ++ 1 file changed, 2 insertions(+) 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() -- 2.30.2