Repository navigation
cpp: model BDE character views and substring utilities - #22583
Conversation
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.
geoffw0
left a comment
There was a problem hiding this comment.
Looks good to me, I'll start CI...
|
Hmm, CI appears to be stuck. Perhaps you could update this PR with a merge of latest |
|
@kumarak , please could you update this PR with a merge of latest |
3ee8ce8 to
423e0ab
Compare
Rebased to the latest |
geoffw0
left a comment
There was a problem hiding this comment.
Thanks for addressing the merge issue. CI now passes and DCA looks good to me.
Thank you for your contribution to CodeQL analysis. 🚀
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.