aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-connection.c
diff options
context:
space:
mode:
authorMatthieu Longo <matthieu.longo@arm.com>2025-04-17 09:11:24 +0100
committerMatthieu Longo <matthieu.longo@arm.com>2025-06-25 09:41:24 +0100
commit86a053ddd1e2534c588d8d6f56752fb51dd1b184 (patch)
treed9812e604152f0b9d5755d7c1b0c4e7d446fc65e /gdb/python/py-connection.c
parentc35217309a9753e1a5666626f779bfd71668de9d (diff)
downloadbinutils-86a053ddd1e2534c588d8d6f56752fb51dd1b184.zip
binutils-86a053ddd1e2534c588d8d6f56752fb51dd1b184.tar.gz
binutils-86a053ddd1e2534c588d8d6f56752fb51dd1b184.tar.bz2
readelf: invalid error message triggered when last tag is an empty string
Disclaimer: this issue cannot occur with Object Attributes v1 (OAv1) while using the GNU binutils because a value of '\0' (empty string) for a tag with a string value is considered as the default value for the attribute, and consequently is eliminated by gas from the output object file during the serialization. An empty string is a valid value for a NTBS tag in both OAv1 and OAv2 [1] cases. However, contrarily to OAv1, a OAv2 subsection can be required and so, tags in this subsection might have to be present even if the value is the default. To comply with this requirement, the OAv2 serializer won't drop the default values. In the case where a NTBS tag has the value '\0' and is last in the object attributes section, the current code in readelf used for dumping the object attributes incorrectly detects an overflow, and prints out an error message for a corrupted string tag. This patch fixes the detection of the overflow so that it now accept an empty string in the last tag of the object attributes section. It also fixes the previous tests for the empty NTBS case and the non-null terminated string one. The fix was also tested in the context of OAv2's patch series [1] where the issue was originally detected. No regression was found. [1]: https://inbox.sourceware.org/binutils/20250509151319.88725-1-matthieu .longo@arm.com/
Diffstat (limited to 'gdb/python/py-connection.c')
0 files changed, 0 insertions, 0 deletions