Add UninitializedNode::getIndirectionIndex/0#21458
Open
jeongsoolee09 wants to merge 1 commit intomainfrom
Open
Add UninitializedNode::getIndirectionIndex/0#21458jeongsoolee09 wants to merge 1 commit intomainfrom
UninitializedNode::getIndirectionIndex/0#21458jeongsoolee09 wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an indirection-index dimension to Public::UninitializedNode so queries can distinguish uninitialized values at different indirection levels (e.g., arrays-of-arrays).
Changes:
- Extend
UninitializedNodeto trackindirectionIndexrather than hard-coding index0. - Expose the indirection level via
UninitializedNode::getIndirectionIndex/0.
Comments suppressed due to low confidence (1)
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowNodes.qll:785
- The doc comment for
getIndirectionIndex()uses different terminology (“level of indirection to get to this node”) than the rest of this file (which consistently says “indirection index”). For consistency and clarity, consider rephrasing to “Gets the indirection index of this node” and (optionally) define what 0/1/... correspond to.
/** Gets the level of indirection to get to this node. */
int getIndirectionIndex() { result = indirectionIndex }
Comment on lines
766
to
+770
| * flow graph. | ||
| */ | ||
| class UninitializedNode extends Node { | ||
| LocalVariable v; | ||
| int indirectionIndex; |
There was a problem hiding this comment.
The class-level doc comment for UninitializedNode now understates the behavior: the implementation no longer represents only indirection level 0. Please update the doc comment to mention that the node can represent different indirection indices (and briefly what 0/1/... mean) so query authors don’t misinterpret it.
This issue also appears on line 784 of the same file.
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.
Add a member predicate
getIndirectionIndextoUninitializedNode. The existing node only took indirection level 0 to account, clouding the existence of uninitialized nodes behind any level of indirection.For example, consider this code:
Previously,
UninitializedNodeonly capturedarray, in its uninitialized state, of typeint[2][3]. However, it is also uninitialized at one level down, being of typeint[3].any(UninitializedNode node | node.getIndirectionIndex() = 1 | node)will now get theint[3]of the above.