fix(freeze): use get_base_address in dumps_dynamic - #2943
Conversation
Signed-off-by: blenbot <harshitiszz23@gmail.com>
Summary of ChangesHello, 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 addresses a critical issue in the dynamic feature serialization process where the base address was not being correctly retrieved. By updating the attribute name used to fetch the base address, the change ensures that dynamic features are serialized with accurate address information, preventing the loss of this crucial data. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a bug in dumps_dynamic where an incorrect attribute name get_base_addr was used to fetch the base address, causing it to always fall back to NO_ADDRESS. The change to use get_base_address aligns with the implementation in dynamic feature extractors. I've added one suggestion to improve code clarity by renaming a local variable for consistency.
| get_base_addr = getattr(extractor, "get_base_address", None) | ||
| base_addr = get_base_addr() if get_base_addr else capa.features.address.NO_ADDRESS |
There was a problem hiding this comment.
While this change correctly fixes the bug by using get_base_address, the local variable get_base_addr is now inconsistently named. It would be clearer to rename it to get_base_address to match the method name being retrieved.
| get_base_addr = getattr(extractor, "get_base_address", None) | |
| base_addr = get_base_addr() if get_base_addr else capa.features.address.NO_ADDRESS | |
| get_base_address = getattr(extractor, "get_base_address", None) | |
| base_addr = get_base_address() if get_base_address else capa.features.address.NO_ADDRESS |
|
thanks @blenbot! |
Summary
While going through
freezein__init__.pyI found thatdumps_dynamicexpects aDynamicFeatureExtractorand it was doing this to getbase_address:get_base_addr = getattr(extractor, "get_base_addr", None)but upon examining extractors(cape,drakvuf,vmray) which subclassesDynamicFeatureExtractor, I noticed all of them have an attribute namedget_base_addressnotget_base_addr.Problem
NO_ADDRESSin all cases and loss of base address information.Changes
get_base_address().Checklist