Skip to content

elf.c: Check e_shstrndx against sections' length, not capacity #5136

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

Merged
merged 1 commit into from
May 7, 2025

Conversation

kazarmy
Copy link
Member

@kazarmy kazarmy commented May 6, 2025

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 every RZ_API function and struct this PR changes.
  • I've added tests that prove my changes are effective (required for changes to RZ_API).
  • I've updated the Rizin book with the relevant information (if needed).

Detailed description

In elf.c, this pr checks e_shstrndx against sections' length and not capacity since the former makes more sense, and sections' length should always be less than or equal its capacity so this is a tighter bound. The original check against capacity was done by rz_vector_index_ptr()'s precondition assertion.

This is a cherry-pick from #5102.

Test plan

The change makes sense. All builds are green.

Closing issues

...

Copy link

codecov bot commented May 6, 2025

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 43.91%. Comparing base (9f70aa1) to head (3af7cfb).
Report is 2 commits behind head on dev.

Files with missing lines Patch % Lines
librz/bin/format/elf/elf.c 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
librz/bin/format/elf/elf.c 72.19% <33.33%> (ø)

... and 12 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f70aa1...3af7cfb. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kazarmy kazarmy merged commit c0344ce into rizinorg:dev May 7, 2025
45 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants