C++: Fix barrier in cpp/unbounded-write#20440
Merged
jketema merged 1 commit intogithub:mainfrom Sep 16, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a barrier implementation in the cpp/unbounded-write security query by ensuring proper handling of expression conversions in the barrier guard logic. The fix addresses regressions that occur when upgrading to the shared guards library.
Key Changes
- Updates the barrier guard to use converted expressions instead of unconverted expressions
- Aligns the implementation with other
DataFlow::BarrierGuardcases in the codebase
jketema
approved these changes
Sep 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Due to historical reasons the predicate you supply to
DataFlow::BarrierGuard(let's call itp) is actually called with the converted expression (see here). Because of this,pmust handle possible conversions on the expression.We do this in all other
DataFlow::BarrierGuardcases, but not on this one.I didn't manage to write a testcase that broke with the current barrier guard implementation, but it fixes a bunch of regressions when upgrading to the shared guards library.