buildtools: allow string constant padding
Size of string constant symbol may be larger than its length
measured up to NUL terminator. In this case pmdinfogen included padding
bytes after NUL terminator in generated source, yielding incorrect code.
Always trim string data to NUL terminator while reading ELF.
It was already done for COFF because there's no symbol size.
Bugzilla ID: 720
Fixes: f0f93a7adf
("buildtools: use Python pmdinfogen")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
This commit is contained in:
parent
31c5af644b
commit
8050b61562
@ -28,7 +28,7 @@ def __init__(self, image, symbol):
|
|||||||
def string_value(self):
|
def string_value(self):
|
||||||
size = self._symbol["st_size"]
|
size = self._symbol["st_size"]
|
||||||
value = self.get_value(0, size)
|
value = self.get_value(0, size)
|
||||||
return value[:-1].decode() if value else ""
|
return coff.decode_asciiz(value) # not COFF-specific
|
||||||
|
|
||||||
def get_value(self, offset, size):
|
def get_value(self, offset, size):
|
||||||
section = self._symbol["st_shndx"]
|
section = self._symbol["st_shndx"]
|
||||||
|
Loading…
Reference in New Issue
Block a user