-
Notifications
You must be signed in to change notification settings - Fork 648
loader: handle SegmentationViolation for malformed ELF files #2799
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @kami922, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the loader's resilience by introducing specific exception handling for Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses a crash when processing malformed ELF files by introducing specific exception handling for envi.exc.SegmentationViolation. The change correctly catches this low-level error and raises a more user-friendly CorruptFile exception, improving the tool's robustness and error reporting. The implementation is clean, follows best practices by chaining exceptions, and includes a corresponding update to the changelog. This is a great improvement.
mike-hunhoff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @kami922. Please see my review and address the requested changes.
- Move import envi.exc to align with viv_utils lazy imports - Update CHANGELOG to reference PR mandiant#2799 instead of issue mandiant#2794 Addresses feedback from @mike-hunhoff
546a672 to
7133762
Compare
mike-hunhoff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kami922 , one last change for your review.
CHANGELOG.md
Outdated
|
|
||
| ### Bug Fixes | ||
|
|
||
| - loader: gracefully handle malformed ELF files with invalid relocations kamranulhaq2002@gmail.com #2799 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to the unreleased section of the CHANGELOG, see
Line 3 in dc47de1
| ## master (unreleased) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kami922 bump
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kami922 this needs to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kami922 this still needs to be removed.
|
Also, @kami922 please sync with the master branch. |
Catch envi.exc.SegmentationViolation raised by vivisect when parsing malformed ELF files with invalid relocations and convert to a user-friendly CorruptFile error message. Follows existing error handling pattern in get_workspace(). Refs mandiant#2799
Catch envi.exc.SegmentationViolation raised by vivisect when parsing malformed ELF files with invalid relocations and convert to a user-friendly CorruptFile error message. Follows existing error handling pattern in get_workspace(). Refs mandiant#2799
|
@mike-hunhoff i had accidently pushed 2nd last commit to wrong branch please check and lemme know |
- Remove old duplicate CHANGELOG entry that was in the wrong version section - Keep only the correct entry in master (unreleased) section with PR mandiant#2799 - Ensure import envi.exc is in lazy import section, not at top level - All pre-commit checks (isort, black, ruff) pass
CHANGELOG.md
Outdated
| - anti-analysis/anti-av/patch-bitdefender-hooking-dll-function jakubjo- nursery/acquire-load-driver-privileges mehunhoff@google.com | ||
| nhoff@google.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kami922 please revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kami922 please revert all changes to this file other than the new entry needed for your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kami922 bump
- CHANGELOG.md: kept both PR mandiant#2800, mandiant#2799, and mandiant#2802 entries - tests/fixtures.py: resolved duplicate and formatting conflicts - .github/workflows/tests.yml: resolved formatting conflict - tests/data: accepted submodule deletion
|
@mike-hunhoff can I please get an update on my PRs I will then shift to CI workflow issue after at least 1 is merged to avoid confusion in future |
|
see the comment regarding the changelog, is there also a test file and test you could add for this? |
Catch envi.exc.SegmentationViolation raised by vivisect when parsing malformed ELF files with invalid relocations and convert to a user-friendly CorruptFile error message. Follows existing error handling pattern in get_workspace(). Refs mandiant#2799
4711f8b to
64efebb
Compare
Catch envi.exc.SegmentationViolation raised by vivisect when processing malformed ELF files with invalid relocations and convert it to a CorruptFile exception with a descriptive message. Closes mandiant#2794
64efebb to
c0dd562
Compare
Fixes #2794
When processing malformed ELF files with invalid relocations, vivisect raises envi.exc.SegmentationViolation during relocation processing. This change catches these exceptions and converts them to CorruptFile exceptions with helpful error messages instead of crashing with a traceback.
Summary
When processing malformed ELF files with invalid relocations, vivisect raises
envi.exc.SegmentationViolationduring relocation processing. This PR catches these exceptions and converts them toCorruptFileexceptions with helpful error messages instead of crashing with a traceback.Changes
envi.exc.SegmentationViolationinget_workspace()CorruptFileexception