Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
| test.cpp:14:24:14:26 | sp3 | The ownership of shared_ptr $@ is not shared within or passed out of the local scope of function $@. | test.cpp:14:24:14:26 | sp3 | sp3 | test.cpp:11:22:11:23 | f1 | f1 |
| test.cpp:16:24:16:26 | sp5 | The ownership of shared_ptr $@ is not shared within or passed out of the local scope of function $@. | test.cpp:16:24:16:26 | sp5 | sp5 | test.cpp:11:22:11:23 | f1 | f1 |
| test.cpp:17:24:17:26 | sp6 | The ownership of shared_ptr $@ is not shared within or passed out of the local scope of function $@. | test.cpp:17:24:17:26 | sp6 | sp6 | test.cpp:11:22:11:23 | f1 | f1 |
| test.cpp:18:24:18:26 | sp7 | The ownership of shared_ptr $@ is not shared within or passed out of the local scope of function $@. | test.cpp:18:24:18:26 | sp7 | sp7 | test.cpp:11:22:11:23 | f1 | f1 |
2 changes: 1 addition & 1 deletion cpp/autosar/test/rules/A20-8-4/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ std::shared_ptr<int> f1() {
std::shared_ptr<int> sp4 = std::make_shared<int>(0); // COMPLIANT
std::shared_ptr<int> sp5 = std::make_shared<int>(0); // NON_COMPLIANT
std::shared_ptr<int> sp6; // NON_COMPLIANT
std::shared_ptr<int> sp7; // COMPLIANT
std::shared_ptr<int> sp7; // COMPLIANT [FALSE POSITIVE]

shared_ptr_obj_param(sp1);
shared_ptr_ref_param(sp2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
| test.cpp:8:42:8:46 | call to begin | Output iterator for $@ is not guaranteed to be large enough for the input iterator. | test.cpp:8:3:8:11 | call to copy | call to copy |
| test.cpp:13:42:13:46 | call to begin | Output iterator for $@ is not guaranteed to be large enough for the input iterator. | test.cpp:13:3:13:11 | call to copy | call to copy |
| test.cpp:17:42:17:46 | call to begin | Output iterator for $@ is not guaranteed to be large enough for the input iterator. | test.cpp:17:3:17:11 | call to copy | call to copy |
| test.cpp:49:42:49:46 | call to begin | Output iterator for $@ is not guaranteed to be large enough for the input iterator. | test.cpp:49:3:49:11 | call to copy | call to copy |
| test.cpp:55:42:55:46 | call to begin | Output iterator for $@ is not guaranteed to be large enough for the input iterator. | test.cpp:55:3:55:11 | call to copy | call to copy |
| test.cpp:59:36:59:40 | call to begin | Output iterator for $@ is not guaranteed to be large enough for the input iterator. | test.cpp:59:3:59:13 | call to copy_n | call to copy_n |
| test.cpp:60:45:60:49 | call to begin | Output iterator for $@ is not guaranteed to be large enough for the input iterator. | test.cpp:60:3:60:14 | call to copy_if | call to copy_if |
Expand Down
4 changes: 2 additions & 2 deletions cpp/cert/test/rules/CTR52-CPP/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void test_basic(std::vector<int> from) {

void test_basic_good(std::vector<int> &src) {
std::vector<int> dest(src.size());
std::copy(src.begin(), src.end(), dest.begin()); // COMPLIANT
std::copy(src.begin(), src.end(), dest.begin()); // COMPLIANT [FALSE POSITIVE]
}

void test_non_local_bad(std::vector<int> &src, std::vector<int> &dest) {
Expand Down Expand Up @@ -46,7 +46,7 @@ void test_back_inserter(std::vector<int> &src) {
void test_fixed_size_correct() {
std::vector<int> dest(10);
std::vector<int> src(10);
std::copy(src.begin(), src.end(), dest.begin()); // COMPLIANT
std::copy(src.begin(), src.end(), dest.begin()); // COMPLIANT [FALSE POSITIVE]
}

void test_fixed_size_broken() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
| test.cpp:6:3:6:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:5:21:5:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:63:3:63:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:58:10:58:13 | call to open | call to open |
| test.cpp:77:3:77:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:70:9:70:9 | call to operator<< | call to operator<< |
| test.cpp:91:5:91:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:89:8:89:8 | call to operator>> | call to operator>> |
| test.cpp:94:5:94:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:92:8:92:13 | call to gcount | call to gcount |
| test.cpp:97:5:97:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:95:8:95:10 | call to get | call to get |
| test.cpp:100:5:100:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:98:8:98:14 | call to getline | call to getline |
| test.cpp:103:5:103:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:101:8:101:13 | call to ignore | call to ignore |
| test.cpp:106:5:106:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:104:8:104:11 | call to peek | call to peek |
| test.cpp:109:5:109:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:107:8:107:11 | call to read | call to read |
| test.cpp:112:5:112:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:110:8:110:15 | call to readsome | call to readsome |
| test.cpp:115:5:115:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:113:8:113:14 | call to putback | call to putback |
| test.cpp:118:5:118:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:116:8:116:12 | call to unget | call to unget |
| test.cpp:121:5:121:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:119:8:119:12 | call to tellg | call to tellg |
| test.cpp:124:5:124:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:122:8:122:12 | call to seekg | call to seekg |
| test.cpp:127:5:127:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:125:8:125:11 | call to sync | call to sync |
| test.cpp:130:5:130:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:128:8:128:8 | call to operator<< | call to operator<< |
| test.cpp:133:5:133:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:131:8:131:10 | call to put | call to put |
| test.cpp:136:5:136:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:134:8:134:12 | call to write | call to write |
| test.cpp:139:5:139:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:137:8:137:12 | call to tellp | call to tellp |
| test.cpp:142:5:142:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:140:8:140:12 | call to seekp | call to seekp |
| test.cpp:145:5:145:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:143:8:143:12 | call to flush | call to flush |
| test.cpp:17:3:17:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:10:21:10:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:30:3:30:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:22:23:22:29 | call to basic_fstream | call to basic_fstream |
| test.cpp:44:3:44:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:34:16:34:19 | call to basic_fstream | call to basic_fstream |
| test.cpp:63:3:63:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:48:16:48:19 | call to basic_fstream | call to basic_fstream |
| test.cpp:77:3:77:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:68:22:68:28 | call to basic_fstream | call to basic_fstream |
| test.cpp:77:3:77:16 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:69:22:69:29 | call to basic_fstream | call to basic_fstream |
| test.cpp:88:5:88:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:91:5:91:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:94:5:94:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:97:5:97:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:100:5:100:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:103:5:103:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:106:5:106:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:109:5:109:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:112:5:112:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:115:5:115:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:118:5:118:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:121:5:121:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:124:5:124:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:127:5:127:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:130:5:130:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:133:5:133:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:136:5:136:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:139:5:139:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:142:5:142:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
| test.cpp:145:5:145:18 | call to terminate | The execution terminates without closing the `fstream` last accessed in $@. | test.cpp:82:21:82:27 | call to basic_fstream | call to basic_fstream |
6 changes: 3 additions & 3 deletions cpp/cert/test/rules/FIO51-CPP/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void test_closed() {
file.close();
if (file.fail()) {
}
std::terminate(); // COMPLIANT
std::terminate(); // COMPLIANT [FALSE POSITIVE]
}

void test_fail() {
Expand All @@ -27,7 +27,7 @@ void test_fail() {
if (file.fail()) {
}
}
std::terminate(); // COMPLIANT
std::terminate(); // COMPLIANT [FALSE POSITIVE]
}

void test_scope() {
Expand All @@ -41,7 +41,7 @@ void test_scope() {
if (file.fail()) {
}
}
std::terminate(); // COMPLIANT
std::terminate(); // COMPLIANT [FALSE POSITIVE]
}

void test_sequence() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
| test.cpp:10:11:10:11 | call to operator>> | Missing call to positioning function before $@. | test.cpp:9:11:9:11 | call to operator<< | call to operator>> |
| test.cpp:11:11:11:11 | call to operator<< | Missing call to positioning function before $@. | test.cpp:10:11:10:11 | call to operator>> | call to operator<< |
| test.cpp:19:11:19:11 | call to operator>> | Missing call to positioning function before $@. | test.cpp:18:11:18:11 | call to operator<< | call to operator>> |
| test.cpp:31:8:31:8 | call to operator<< | Missing call to positioning function before $@. | test.cpp:29:8:29:8 | call to operator>> | call to operator<< |
| test.cpp:41:12:41:12 | call to operator>> | Missing call to positioning function before $@. | test.cpp:40:6:40:6 | call to operator<< | call to operator>> |
| test.cpp:42:6:42:6 | call to operator<< | Missing call to positioning function before $@. | test.cpp:41:12:41:12 | call to operator>> | call to operator<< |
| test.cpp:52:14:52:14 | call to operator<< | Missing call to positioning function before $@. | test.cpp:51:14:51:14 | call to operator>> | call to operator<< |
| test.cpp:63:12:63:12 | call to operator<< | Missing call to positioning function before $@. | test.cpp:62:12:62:12 | call to operator>> | call to operator<< |
| test.cpp:103:12:103:12 | call to operator<< | Missing call to positioning function before $@. | test.cpp:99:12:99:12 | call to operator>> | call to operator<< |
14 changes: 7 additions & 7 deletions cpp/common/test/rules/iofstreammissingpositioning/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ std::string str("output:");
void test_local() {
std::fstream f_local("file");
f_local << "some data"; // COMPLIANT
f_local >> str; // NON_COMPLIANT
f_local << "more data"; // NON_COMPLIANT
f_local >> str; // NON_COMPLIANT [MISSING]
f_local << "more data"; // NON_COMPLIANT [MISSING]
f_local.seekp(0);
f_local >> str; // COMPLIANT
};
void test_local2() {
std::fstream f_local("file");
f_local << "some data"; // COMPLIANT
f_local << "more data"; // COMPLIANT
f_local >> str; // NON_COMPLIANT
f_local >> str; // NON_COMPLIANT [MISSING]
f_local >> str; // COMPLIANT
};

Expand All @@ -28,7 +28,7 @@ void test_2streams() {
f_s1 << "some data";
f_s2 >> str; // COMPLIANT
f_s1.seekp(0);
f_s2 << "some data"; // NON_COMPLIANT
f_s2 << "some data"; // NON_COMPLIANT [MISSING]
f_s1 >> str; // COMPLIANT
}

Expand All @@ -38,8 +38,8 @@ void test_alias() {
std::fstream &alias_f1 = f1;

f1 << "some data";
alias_f1 >> str; // NON_COMPLIANT
f1 << "more data"; // NON_COMPLIANT
alias_f1 >> str; // NON_COMPLIANT [MISSING]
f1 << "more data"; // NON_COMPLIANT [MISSING]
}

// class member variable
Expand Down Expand Up @@ -100,5 +100,5 @@ void test_branch(int rand) {
if (rand > 10) {
f_branch.seekp(0);
}
f_branch << "more data"; // NON_COMPLIANT
f_branch << "more data"; // NON_COMPLIANT [MISSING]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
problems
| test.cpp:5:27:5:28 | v1 | test.cpp:4:13:4:14 | v1 | test.cpp:5:27:5:28 | v1 | Raw pointer flows to initialize multiple unrelated smart pointers. |
| test.cpp:5:27:5:28 | v1 | test.cpp:16:13:16:22 | new | test.cpp:5:27:5:28 | v1 | Raw pointer flows to initialize multiple unrelated smart pointers. |
| test.cpp:6:31:6:33 | call to get | test.cpp:4:13:4:14 | v1 | test.cpp:6:31:6:33 | call to get | Raw pointer flows to initialize multiple unrelated smart pointers. |
| test.cpp:6:31:6:33 | call to get | test.cpp:16:13:16:22 | new | test.cpp:6:31:6:33 | call to get | Raw pointer flows to initialize multiple unrelated smart pointers. |
| test.cpp:7:28:7:29 | v2 | test.cpp:4:13:4:14 | v1 | test.cpp:7:28:7:29 | v2 | Raw pointer flows to initialize multiple unrelated smart pointers. |
| test.cpp:7:28:7:29 | v2 | test.cpp:16:13:16:22 | new | test.cpp:7:28:7:29 | v2 | Raw pointer flows to initialize multiple unrelated smart pointers. |
| test.cpp:11:28:11:29 | v2 | test.cpp:10:8:10:17 | new | test.cpp:11:28:11:29 | v2 | Raw pointer flows to initialize multiple unrelated smart pointers. |
Expand All @@ -11,18 +9,10 @@ problems
edges
| test.cpp:3:14:3:15 | v1 | test.cpp:4:13:4:14 | v1 | provenance | |
| test.cpp:3:14:3:15 | v1 | test.cpp:5:27:5:28 | v1 | provenance | |
| test.cpp:3:14:3:15 | v1 | test.cpp:5:27:5:28 | v1 | provenance | |
| test.cpp:4:13:4:14 | v1 | test.cpp:4:13:4:14 | v1 | provenance | |
| test.cpp:4:13:4:14 | v1 | test.cpp:5:27:5:28 | v1 | provenance | |
| test.cpp:4:13:4:14 | v1 | test.cpp:5:27:5:28 | v1 | provenance | |
| test.cpp:4:13:4:14 | v1 | test.cpp:7:28:7:29 | v2 | provenance | |
| test.cpp:4:13:4:14 | v1 | test.cpp:7:28:7:29 | v2 | provenance | |
| test.cpp:5:24:5:25 | call to shared_ptr | test.cpp:6:28:6:29 | p1 | provenance | |
| test.cpp:5:24:5:25 | call to shared_ptr | test.cpp:6:28:6:29 | p1 | provenance | |
| test.cpp:5:27:5:28 | v1 | test.cpp:5:24:5:25 | call to shared_ptr | provenance | Config |
| test.cpp:5:27:5:28 | v1 | test.cpp:5:24:5:25 | call to shared_ptr | provenance | Config |
| test.cpp:6:28:6:29 | p1 | test.cpp:6:31:6:33 | call to get | provenance | Config |
| test.cpp:6:28:6:29 | p1 | test.cpp:6:31:6:33 | call to get | provenance | Config |
| test.cpp:8:3:8:14 | ... = ... | test.cpp:9:28:9:29 | v2 | provenance | |
| test.cpp:8:8:8:14 | 0 | test.cpp:8:3:8:14 | ... = ... | provenance | |
| test.cpp:10:3:10:17 | ... = ... | test.cpp:11:28:11:29 | v2 | provenance | |
Expand All @@ -39,14 +29,7 @@ nodes
| test.cpp:4:13:4:14 | v1 | semmle.label | v1 |
| test.cpp:4:13:4:14 | v1 | semmle.label | v1 |
| test.cpp:4:13:4:14 | v1 | semmle.label | v1 |
| test.cpp:5:24:5:25 | call to shared_ptr | semmle.label | call to shared_ptr |
| test.cpp:5:24:5:25 | call to shared_ptr | semmle.label | call to shared_ptr |
| test.cpp:5:27:5:28 | v1 | semmle.label | v1 |
| test.cpp:5:27:5:28 | v1 | semmle.label | v1 |
| test.cpp:5:27:5:28 | v1 | semmle.label | v1 |
| test.cpp:6:28:6:29 | p1 | semmle.label | p1 |
| test.cpp:6:28:6:29 | p1 | semmle.label | p1 |
| test.cpp:6:31:6:33 | call to get | semmle.label | call to get |
| test.cpp:7:28:7:29 | v2 | semmle.label | v2 |
| test.cpp:8:3:8:14 | ... = ... | semmle.label | ... = ... |
| test.cpp:8:8:8:14 | 0 | semmle.label | 0 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
void f2(int *v1) {
int *v2 = v1;
std::shared_ptr<int> p1(v1); // NON_COMPLIANT
new std::shared_ptr<int>(p1.get()); // NON_COMPLIANT
new std::shared_ptr<int>(p1.get()); // NON_COMPLIANT [MISSING]
new std::shared_ptr<int>(v2); // NON_COMPLIANT
v2 = nullptr;
new std::shared_ptr<int>(v2); // COMPLIANT
Expand Down
Loading
Loading