Skip to content

Commit 4202759

Browse files
authored
Update test.cpp
1 parent 1e12ede commit 4202759

File tree

1 file changed

+18
-0
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests

1 file changed

+18
-0
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests/test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
namespace std
2+
{
3+
class exception {
4+
};
5+
6+
class runtime_error : public exception {
7+
public:
8+
runtime_error(const char *msg);
9+
};
10+
}
11+
112
typedef unsigned int size_t;
213
void clean();
314

@@ -18,6 +29,13 @@ void funcTest2()
1829
try { throw "my exception!"; } // GOOD
1930
catch (...) { clean(); }
2031
}
32+
33+
void funcTest3()
34+
{
35+
std::runtime_error("msg error"); // BAD
36+
throw std::runtime_error("msg error"); // GOOD
37+
}
38+
2139
void TestFunc()
2240
{
2341
funcTest1();

0 commit comments

Comments
 (0)