ARMAttribute: fix access to structs, stream and nul
Signed-off-by: lb1107039128 <liubo1@xfusion.com>
This commit is contained in:
parent
73a975c915
commit
464dd71fe8
@ -0,0 +1,53 @@
|
||||
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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: pyelftools
|
||||
Version: 0.25
|
||||
Release: 3
|
||||
Release: 4
|
||||
License: Public Domain
|
||||
Summary: Pure-Python library for parsing and analyzing ELF files
|
||||
URL: https://github.com/eliben/pyelftools
|
||||
@ -9,6 +9,8 @@ Source0: https://files.pythonhosted.org/packages/source/p/pyelftools/pyel
|
||||
BuildRequires: python3-devel python3-setuptools
|
||||
BuildArch: noarch
|
||||
|
||||
Patch0001: 0001-ARMAttribute-fix-access-to-structs-stream-and-nul-20.patch
|
||||
|
||||
%description
|
||||
This package provides a python library for parsing and
|
||||
analyzing ELF files and DWARF debugging information.
|
||||
@ -44,6 +46,9 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/pyreadelf
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Jan 11 2024 liubo <liubo1@xfusion.com> - 0.25-4
|
||||
- ARMAttribute: fix access to structs, stream and nul
|
||||
|
||||
* Mon Nov 16 2020 baizhonggui<baizhonggui@huawei.com> - 0.25-3
|
||||
- Drop Python 2 subpackage
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user