Skip to content
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

Fix for redundant assertion in ValueRangeAnalysisFactory #2887

Merged
merged 2 commits into from Mar 4, 2024

Conversation

gtoison
Copy link
Contributor

@gtoison gtoison commented Mar 2, 2024

When a redundant condition is used in an assertion ValueRangeAnalysisFactory tries to compute the position of the end end for the corresponding instruction block. However it uses IFNE.getTarget().getPosition() which returns the position offset (not he position).
Since the offset is zero, this produces and invalid range (end is before start) and BitSet.set(start, end) throws an exception.

Instead compute the end of the block by locating the final athrow

Crash reported in issue #608

@gtoison gtoison marked this pull request as ready for review March 2, 2024 19:32
@hazendaz hazendaz self-assigned this Mar 4, 2024
@hazendaz hazendaz merged commit ac3de21 into spotbugs:master Mar 4, 2024
15 checks passed
@hazendaz hazendaz added this to the SpotBugs 4.8.4 milestone Mar 4, 2024
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.

None yet

2 participants