Skip to content

Fix data flow analysis for multiple text sections #220

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

stravant
Copy link
Contributor

@stravant stravant commented Jul 6, 2025

  • Data flow analysis results were only keyed by the symbol (function) address. That doesn't work if there are multiple text sections. The result from the first function in one text section will stomp the result from the first function in another because both have address zero.

  • Remove the ambiguity by keying off of the section address as well.

stravant added 5 commits July 5, 2025 21:42
* Data flow analysis results were only keyed by the symbol (function)
  address. That doen't work if there are multiple text sections, the
  result from the first function in one section will stomp the result
  from the first function in another because both have address zero.

* Remove the ambiguity by keying off of the section address as well.
@stravant
Copy link
Contributor Author

stravant commented Jul 6, 2025

PR does build, not sure why clippy is failing for stuff I didn't touch.

@@ -273,7 +273,7 @@ pub struct Object {
pub path: Option<std::path::PathBuf>,
#[cfg(feature = "std")]
pub timestamp: Option<filetime::FileTime>,
pub flow_analysis_results: BTreeMap<u64, Box<dyn FlowAnalysisResult>>,
flow_analysis_results: BTreeMap<u64, Box<dyn FlowAnalysisResult>>,
Copy link
Owner

Choose a reason for hiding this comment

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

Let's keep this pub, otherwise Object isn't constructible outside of the crate

symbol: &Symbol,
result: Box<dyn FlowAnalysisResult>,
) {
let key = symbol.section.unwrap_or_default() as u64 + symbol.address;
Copy link
Owner

Choose a reason for hiding this comment

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

This key seems like it could easily overlap, the section indices are small numbers

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.

2 participants