Skip to content

Commit 92f56cd

Browse files
committed
fix typos in tests/query
1 parent db2479c commit 92f56cd

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

cpp/src/security/UnsafeImplicitConversions/UnsafeImplicitConversions.ql

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -218,33 +218,31 @@ predicate safeBounds(Expr cast, IntegralType toType) {
218218
safeLowerBound(cast, toType) and safeUpperBound(cast, toType)
219219
}
220220

221-
/**
221+
/*
222222
* Taint tracking from user-controlled inputs to implicit conversions
223-
* UNUSED: uncomment the code near "select" statement at the bottom to use
223+
* UNUSED: uncomment code below and the code near "select" statement at the bottom of the file
224224
*/
225-
module UnsafeUserInputConversionConfig implements DataFlow::ConfigSig {
226-
predicate isSource(DataFlow::Node source) {
227-
exists(RemoteFlowSourceFunction remoteFlow |
228-
remoteFlow = source.asExpr().(Call).getTarget() and
229-
remoteFlow.hasRemoteFlowSource(_, _)
230-
)
231-
or
232-
exists(LocalFlowSourceFunction localFlow |
233-
localFlow = source.asExpr().(Call).getTarget() and
234-
localFlow.hasLocalFlowSource(_, _)
235-
)
236-
}
237-
238-
predicate isSink(DataFlow::Node sink) {
239-
exists(IntegralConversion cast |
240-
cast.isImplicit() and
241-
cast.getExpr() = sink.asExpr()
242-
)
243-
}
244-
}
245-
246-
module UnsafeUserInputConversionFlow = TaintTracking::Global<UnsafeUserInputConversionConfig>;
247225

226+
// module UnsafeUserInputConversionConfig implements DataFlow::ConfigSig {
227+
// predicate isSource(DataFlow::Node source) {
228+
// exists(RemoteFlowSourceFunction remoteFlow |
229+
// remoteFlow = source.asExpr().(Call).getTarget() and
230+
// remoteFlow.hasRemoteFlowSource(_, _)
231+
// )
232+
// or
233+
// exists(LocalFlowSourceFunction localFlow |
234+
// localFlow = source.asExpr().(Call).getTarget() and
235+
// localFlow.hasLocalFlowSource(_, _)
236+
// )
237+
// }
238+
// predicate isSink(DataFlow::Node sink) {
239+
// exists(IntegralConversion cast |
240+
// cast.isImplicit() and
241+
// cast.getExpr() = sink.asExpr()
242+
// )
243+
// }
244+
// }
245+
// module UnsafeUserInputConversionFlow = TaintTracking::Global<UnsafeUserInputConversionConfig>;
248246
from
249247
IntegralConversion cast, IntegralType fromType, IntegralType toType, Expr castExpr,
250248
string problemType
@@ -320,9 +318,9 @@ where
320318
or
321319
addressIsTaken(cast.getEnclosingFunction())
322320
)
323-
// Uncomment to report conversions with untrusted inputs only
321+
// UNUSED: Uncomment to report conversions with untrusted inputs only
324322
// and exists(DataFlow::Node source, DataFlow::Node sink |
325-
// cast.getExpr() = sink.asExpr() and
323+
// castExpr = sink.asExpr() and
326324
// UnsafeUserInputConversionFlow::flow(source, sink)
327325
// )
328326
select cast, "Implicit cast from " + fromType + " to " + toType + " (" + problemType + ")"

cpp/test/query-tests/security/UnsafeImplicitConversions/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void test_fp14() {
356356
uint64_t large = (uint64_t)0x100000001;
357357
test_func_1((int)large);
358358
test_func_1(static_cast<int>(large));
359-
test_func_1(int{large});
359+
test_func_1(int(large));
360360
}
361361

362362
void test_fp15() {
@@ -449,7 +449,7 @@ int main(int argc, char **argv) {
449449
test_fp13();
450450
test_fp14();
451451
test_fp15();
452-
test_fp16((unsigned short)argc, (unsigned short)argv[0]);
452+
test_fp16((unsigned short)argc, (unsigned short)argc);
453453
test_fp17((int)argc);
454454
test_fp18((unsigned int)argc);
455455
test_fp19((int)argc);

0 commit comments

Comments
 (0)