Skip to content

Conversation

@plafosse
Copy link
Member

@plafosse plafosse commented Jun 3, 2025

we weren't handling zero offsets from structures at all it looks like.
#6825

@CLAassistant
Copy link

CLAassistant commented Jun 3, 2025

CLA assistant check
All committers have signed the CLA.

@plafosse plafosse requested review from Copilot and rssor June 24, 2025 13:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issue binaryninja-api#6825 by refining the handling of zero offsets in structure member evaluation. Key changes include:

  • Replacing the dereference flag with a member resolution flag (memberResolved)
  • Updating token rendering logic to always use instr.size for type casts
  • Revising pointer arithmetic handling to only append arithmetic tokens when the offset is non-zero
Comments suppressed due to low confidence (3)

lang/c/pseudoc.cpp:2467

  • [nitpick] Consider renaming 'memberResolved' to 'isMemberResolved' for improved clarity and consistency with boolean naming conventions.
			bool memberResolved = false;

lang/c/pseudoc.cpp:2520

  • Ensure that always using 'instr.size' instead of conditionally selecting a size value is the intended design for the type cast, as this change may affect the formatting of the resulting expression.
				AppendSizeToken(instr.size, true, tokens);

lang/c/pseudoc.cpp:2536

  • Confirm that the decision to only append pointer arithmetic tokens when offset is non-zero fully addresses the zero offset issue without unintended side effects in pointer arithmetic scenarios.
			if (offset != 0)

@bdash bdash force-pushed the test_fix_6825 branch 3 times, most recently from 18f70cd to 7a4e006 Compare July 16, 2025 18:45
@bdash bdash merged commit 400c215 into dev Jul 16, 2025
1 check passed
@bdash bdash deleted the test_fix_6825 branch July 16, 2025 22:19
@emesare emesare added this to the Helion milestone Jul 23, 2025
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.

6 participants