[PATCH v2 1/1] readelf: invalid error message triggered when last tag is an empty string
Jan Beulich
jbeulich@suse.com
Mon Jun 23 09:48:08 GMT 2025
On 23.06.2025 11:23, Matthieu Longo wrote:
> On 2025-06-23 06:53, Jan Beulich wrote:
>> On 20.06.2025 17:13, Matthieu Longo wrote:
>>> On 2025-06-20 09:40, Jan Beulich wrote:
>>>> On 19.06.2025 10:43, Matthieu Longo wrote:
>>>>> + print_symbol_name ((int) maxlen, (const char *) p);
>>>>
>>>> ... the function will bail early if passed 0.
>>>>
>>>> However - is using print_symbol_name() actually correct here? Surely it
>>>> is bogus to demangle this string, in the (however unlikely) event that it
>>>> turns out demanglable?
>>>
>>> I think that it is correct. It will print "[...]" for a string finishing
>>> with no null terminator, but you can trigger the printing of the string
>>> until a maximum of maxlen if you pass -T (--silent-truncation) to readelf.
>>
>> You don't touch on the demangling aspect at all?
>
> Demangling should not be needed for object attributes, but
> print_symbol_name() has been working up until now, I don't have plan to
> change it unless there is a good reason.
>
> Do you mean by bogus here that a demangling could mistakenly be applied
> on a non-mangled string starting with chance with _Z for instance ?
Yes, that's what I mean. Imo the function should be used only for what
truly is a symbol name. (It's likely even wrong to call it for e.g.
section names, for the same reason.)
Jan
More information about the Binutils
mailing list