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 oob write for dwarf with abbrev with count 0 (Fix #2083) #2086

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

thestr4ng3r
Copy link
Member

@thestr4ng3r thestr4ng3r commented Dec 10, 2021

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Fix #2083

Detailed description

This is described in #2083.

die->attr_values = calloc(sizeof(RzBinDwarfAttrValue), attr_count);
if (!die->attr_values) {
return -1;
if (attr_count) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this check really necessary? Isn't checking for ->capacity in the various uses enough?
Also, this is init_die function, is it alright to have die->attr_values potentially not initialized? (i didn't check if the caller already initialize it).

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it is not strictly required. It only affects whether we then have NULL or whatever calloc() gives for a zero size. I kind of prefer the former.

@github-actions github-actions bot added the DWARF label Dec 10, 2021
@thestr4ng3r thestr4ng3r merged commit aa69177 into dev Dec 10, 2021
@wargio wargio deleted the dwarf-empty branch December 7, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Heap-based OOB write when parsing dwarf die info
4 participants