Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in readelf.py if a symbol doesn't define st_shndx #566

Closed
wants to merge 1 commit into from

Conversation

berolinux
Copy link

symbol['st_shndx'] can take a value of 'SHN_UNDEF' -- causing a crash in readelf.py when dumping the symbol table since that non-numeric value can't be compared to self.elffile.num_sections().

Add a check before assuming st_shndx is numeric.

symbol['st_shndx'] can take a value of 'SHN_UNDEF' -- causing a crash in
readelf.py when dumping the symbol table since that non-numeric value
can't be compared to self.elffile.num_sections().

Add a check before assuming st_shndx is numeric.
Copy link
Owner

@eliben eliben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the type cast here; can we make the check more semantic with an explanation of what other values can be encountered?

@sevaa FYI

@sevaa
Copy link
Contributor

sevaa commented Aug 5, 2024

I'd do a plain comparison to the string literal 'SHN_UNDEF'. But no pressure :)

@sevaa
Copy link
Contributor

sevaa commented Oct 28, 2024

@eliben this was addressed by #574

@eliben eliben closed this Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants