Skip to content

Commit 587ae07

Browse files
committed
C++: Accept query test changes.
1 parent 8f11cb6 commit 587ae07

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
| test.cpp:680:30:680:30 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:680:17:680:17 | call to begin | call to begin |
2+
| test.cpp:680:30:680:30 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:680:17:680:17 | call to end | call to end |
3+
| test.cpp:683:31:683:32 | call to at | This object is destroyed before $@ is called. | test.cpp:683:17:683:17 | call to begin | call to begin |
4+
| test.cpp:683:31:683:32 | call to at | This object is destroyed before $@ is called. | test.cpp:683:17:683:17 | call to end | call to end |
5+
| test.cpp:689:17:689:29 | temporary object | This object is destroyed before $@ is called. | test.cpp:689:31:689:35 | call to begin | call to begin |
6+
| test.cpp:689:46:689:58 | temporary object | This object is destroyed before $@ is called. | test.cpp:689:60:689:62 | call to end | call to end |
7+
| test.cpp:702:27:702:27 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:703:19:703:23 | call to begin | call to begin |
8+
| test.cpp:702:27:702:27 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:703:36:703:38 | call to end | call to end |
9+
| test.cpp:716:36:716:48 | temporary object | This object is destroyed before $@ is called. | test.cpp:716:17:716:17 | call to begin | call to begin |
10+
| test.cpp:716:36:716:48 | temporary object | This object is destroyed before $@ is called. | test.cpp:716:17:716:17 | call to end | call to end |
11+
| test.cpp:727:23:727:23 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:750:17:750:17 | call to begin | call to begin |
12+
| test.cpp:727:23:727:23 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:750:17:750:17 | call to end | call to end |
13+
| test.cpp:735:23:735:23 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:759:17:759:17 | call to begin | call to begin |
14+
| test.cpp:735:23:735:23 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:759:17:759:17 | call to end | call to end |

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-416/test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,10 @@ std::vector<std::vector<int>> return_self_by_value(const std::vector<std::vector
677677

678678
void test() {
679679
for (auto x : returnValue()) {} // GOOD
680-
for (auto x : returnValue()[0]) {} // BAD [NOT DETECTED] (see *)
680+
for (auto x : returnValue()[0]) {} // BAD
681681
for (auto x : external_by_value(returnValue())) {} // GOOD
682682
for (auto x : external_by_const_ref(returnValue())) {} // GOOD
683-
for (auto x : returnValue().at(0)) {} // BAD [NOT DETECTED] (see *)
683+
for (auto x : returnValue().at(0)) {} // BAD
684684

685685
for (auto x : returnRef()) {} // GOOD
686686
for (auto x : returnRef()[0]) {} // GOOD
@@ -700,7 +700,7 @@ void test() {
700700

701701
{
702702
auto&& v = returnValue()[0];
703-
for(auto it = v.begin(); it != v.end(); ++it) {} // BAD [NOT DETECTED] (see *)
703+
for(auto it = v.begin(); it != v.end(); ++it) {} // BAD
704704
}
705705

706706
{
@@ -713,7 +713,7 @@ void test() {
713713
for(auto it = v.begin(); it != v.end(); ++it) {} // GOOD
714714
}
715715

716-
for (auto x : return_self_by_ref(returnValue())) {} // BAD [NOT DETECTED] (see *)
716+
for (auto x : return_self_by_ref(returnValue())) {} // BAD
717717

718718
for (auto x : return_self_by_value(returnValue())) {} // GOOD
719719
}
@@ -724,15 +724,15 @@ void iterate(const std::vector<T>& v) {
724724
}
725725

726726
std::vector<int>& ref_to_first_in_returnValue_1() {
727-
return returnValue()[0]; // BAD [NOT DETECTED] (see *)
727+
return returnValue()[0]; // BAD
728728
}
729729

730730
std::vector<int>& ref_to_first_in_returnValue_2() {
731731
return returnValue()[0]; // BAD [NOT DETECTED]
732732
}
733733

734734
std::vector<int>& ref_to_first_in_returnValue_3() {
735-
return returnValue()[0]; // BAD [NOT DETECTED] (see *)
735+
return returnValue()[0]; // BAD
736736
}
737737

738738
std::vector<int> first_in_returnValue_1() {

0 commit comments

Comments
 (0)