diff --git a/tools/import_audit.py b/tools/import_audit.py index 83ad3722d4..57cf09a9b1 100644 --- a/tools/import_audit.py +++ b/tools/import_audit.py @@ -127,16 +127,18 @@ def elf_program_dynamic_symbols(path, data): bucket_data = take(data, bucket_offset, buckets * 4, path, "GNU hash buckets") chain_offset = bucket_offset + buckets * 4 maximum = first_symbol - 1 + visited_chain_entries = set() for index in struct.unpack(f"<{buckets}I", bucket_data) if buckets else (): if index == 0: continue if index < first_symbol: raise AuditError(f"{path}: GNU hash bucket index {index} precedes symbol offset {first_symbol}") symbol_index = index - while True: + while symbol_index not in visited_chain_entries: chain_address = dynamic[0x6ffffef5] + (chain_offset - hash_offset) + (symbol_index - first_symbol) * 4 chain_file_offset = file_offset(chain_address, 4, "GNU hash chain") chain_value = unpack("