[PATCH] objdump: avoid possible SIGSEGV when printing debug info [BZ #32829]

Collin Funk collin.funk1@gmail.com
Tue Apr 1 16:34:21 GMT 2025


Jan Beulich <jbeulich@suse.com> writes:

>> I didn't see Collin's patch before I wrote my own fix (which at first
>> looked just like Collin's).  I had considered whether it was necessary
>> to worry about all the pointers, but decided that the code testing for
>> NULL u.kenum was simply wrong as that can never happen.  The correct
>> check is for NULL u.kenum->names (or NULL u.kenum->values, either will
>> do).
>
> Why is it that either will do? Shouldn't there then at least be an assertion
> that both need to be NULL / non-NULL at the same time?

I checked in gdb and both u.kenum->names and u.kenum->values were NULL
for each enum.

I suppose an assertion would work well enough.

Collin


More information about the Binutils mailing list