PCode: fix bug in pcode's SequenceNumber.java #6410
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello.
This PR is related to a Potential Comparison Logic Issue in pcode's SequenceNumber.java.
When I try to analyze High PCode (PcodeOpAST) from decompiler using following code
I Found PcodeOpAST's order is wrong.
For Example,
*(int *)(param_1 + 0x24)
has following PcodeOpAST order get fromgetPcodeOps()
But what we expected is
So finally I found there maybe a issue in SequenceNumber's
compareTo
method, which can affect the result ofmethod
getPcodeOps()
.In the
compareTo
method, sequence numbers are first compared based on their instruction address pc. If the addresses differ, the comparison result is determined by the outcome of comparing these addresses. If the addresses are the same, then the comparison is based on the values of the uniq field.However, I think the correct logic is to compare the
order
field after comparing addresspc
, so as to ensure the correct order of PCodeAST and not affect the results of subsequent program analysis.