Skip to content

Commit 3b05adc

Browse files
committed
Update MovedFromObjectsUnspecifiedState to the new dataflow library
1 parent 4d16b3b commit 3b05adc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cpp/common/src/codingstandards/cpp/rules/movedfromobjectsunspecifiedstate/MovedFromObjectsUnspecifiedState.qll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import cpp
7-
import semmle.code.cpp.dataflow.DataFlow
7+
import semmle.code.cpp.dataflow.new.DataFlow
88
import codingstandards.cpp.Exclusions
99
import codingstandards.cpp.standardlibrary.Utility
1010

@@ -75,9 +75,10 @@ query predicate problems(Expr e, string message, StdMoveCall f, string argDesc)
7575
not e instanceof ReassignedExpression and
7676
// object moved to safe functions are preserved
7777
not exists(SafeRead safe | f = safe.getArgument(0)) and
78-
exists(DataFlow::DefinitionByReferenceNode def |
79-
def.asDefiningArgument() = f and
80-
DataFlow::localFlow(def, DataFlow::exprNode(e))
78+
exists(DataFlow::DefinitionByReferenceNode def, DataFlow::Node n |
79+
f.getArgument(0) = def.getArgument() and
80+
n.asIndirectExpr() = e and
81+
DataFlow::localFlow(def, n)
8182
) and
8283
message = "The argument of the $@ may be indeterminate when accessed at this location." and
8384
argDesc = f.toString()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
| test.cpp:9:16:9:17 | s1 | The argument of the $@ may be indeterminate when accessed at this location. | test.cpp:7:18:7:26 | call to move | call to move |
22
| test.cpp:30:5:30:5 | s | The argument of the $@ may be indeterminate when accessed at this location. | test.cpp:31:11:31:19 | call to move | call to move |
3-
| test.cpp:31:11:31:22 | call to basic_string | The argument of the $@ may be indeterminate when accessed at this location. | test.cpp:31:11:31:19 | call to move | call to move |
3+
| test.cpp:31:11:31:19 | call to move | The argument of the $@ may be indeterminate when accessed at this location. | test.cpp:31:11:31:19 | call to move | call to move |
44
| test.cpp:31:21:31:21 | s | The argument of the $@ may be indeterminate when accessed at this location. | test.cpp:31:11:31:19 | call to move | call to move |
55
| test.cpp:79:16:79:23 | s_global | The argument of the $@ may be indeterminate when accessed at this location. | test.cpp:78:18:78:26 | call to move | call to move |

0 commit comments

Comments
 (0)