pyelftools/0001-ARMAttribute-fix-access-to-structs-stream-and-nul-20.patch
lb1107039128 464dd71fe8 ARMAttribute: fix access to structs, stream and nul
Signed-off-by: lb1107039128 <liubo1@xfusion.com>
2024-01-11 15:39:42 +08:00

54 lines
2.1 KiB
Diff

From c2f6fe363f0bbeb595946204b3c41d4034126840 Mon Sep 17 00:00:00 2001
From: Andreas Ziegler <ziegler@einserver.de>
Date: Thu, 25 Oct 2018 14:31:20 +0200
Subject: [PATCH] ARMAttribute: fix access to structs, stream and nul (#203)
The __init__ function of ARMAttribute has two parameters
structs and stream through which the caller can pass in the
relevant objects (ARMAttributesSubsubsection does that after
seeking to the right position in stream).
The accesses for TAG_SECTION and TAG_SYMBOL, however, were
referring to non-existing members instead of the parameters.
Additionally, one assertion tries to access an undefined
'null_byte' variable which should be 'nul' instead.
---
elftools/elf/sections.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/elftools/elf/sections.py b/elftools/elf/sections.py
index 20e9056..9d16b24 100644
--- a/elftools/elf/sections.py
+++ b/elftools/elf/sections.py
@@ -287,14 +287,12 @@ class ARMAttribute(object):
if self.tag != 'TAG_FILE':
self.extra = []
- s_number = struct_parse(self.structs.Elf_uleb128('s_number'),
- self.stream
- )
+ s_number = struct_parse(structs.Elf_uleb128('s_number'), stream)
while s_number != 0:
self.extra.append(s_number)
- s_number = struct_parse(self.structs.Elf_uleb128('s_number'),
- self.stream
+ s_number = struct_parse(structs.Elf_uleb128('s_number'),
+ stream
)
elif self.tag in ('TAG_CPU_RAW_NAME', 'TAG_CPU_NAME', 'TAG_CONFORMANCE'):
@@ -313,7 +311,7 @@ class ARMAttribute(object):
if type(self.value.value) is not str:
nul = struct_parse(structs.Elf_byte('nul'), stream)
- elf_assert(null_byte == 0,
+ elf_assert(nul == 0,
"Invalid terminating byte %r, expecting NUL." % nul)
else:
--
2.42.0.windows.2