Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The models are narrowly scoped, preserve character flow without propagating metadata, and are covered by focused tests.
Pull request overview
Adds C++ data-flow models for BDE character views and substring utilities.
Changes:
- Models pointer-based
StringRefImpconstruction and character access. - Models eight
StringRefUtiloperations while excluding metadata and patterns. - Adds narrow/wide positive and negative flow tests.
File summaries
| File | Description |
|---|---|
cpp/ql/lib/semmle/code/cpp/models/Models.qll |
Registers the new implementation model. |
cpp/ql/lib/semmle/code/cpp/models/implementations/BdlbStringRef.qll |
Models pointer-based view construction. |
cpp/ql/lib/ext/bdlb.stringref.model.yml |
Defines access and utility summaries. |
cpp/ql/test/library-tests/dataflow/bdlb-stringref/test.cpp |
Adds positive and negative flow cases. |
cpp/ql/test/library-tests/dataflow/bdlb-stringref/flow.ql |
Configures the taint-flow test. |
cpp/ql/test/library-tests/dataflow/bdlb-stringref/flow.expected |
Provides the test expectation artifact. |
cpp/ql/lib/change-notes/2026-09-15-bdlb-stringref.md |
Documents the analysis improvement. |
Review details
- Files reviewed: 6/7 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
This change models character flow through pointer-based
bslstl::StringRefImpconstruction,data,begin, and indexed access, plusbdlb::StringRefUtiloperations includingtrim/ltrim/rtrim,substr, and thestrstr/strrstrcaseless variants.The models target the
StringRefImptemplate behind the publicStringReftypedef and keep referenced characters separate from search patterns, positions, and lengths, preventing metadata from becoming returned character data.Tests cover copying, pointer-range and integral-length constructors, narrow/wide character access, all eight utilities, and negative pattern/metadata cases.