mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
C++: Accept test changes.
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
| test.cpp:29:13:29:24 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:37:13:37:24 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:41:13:41:24 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:49:8:49:19 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:58:8:58:19 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:63:8:63:19 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:92:5:92:31 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:93:15:93:41 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:96:10:96:36 | call to operator new[] | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:151:9:151:24 | call to operator new | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:157:9:157:28 | call to operator new | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:182:15:182:35 | call to operator new | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:187:15:187:35 | call to operator new | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:192:15:192:35 | call to operator new | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:199:15:199:35 | call to operator new | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:204:15:204:35 | call to operator new | memory allocation error check is incorrect or missing |
|
||||
| test.cpp:21:9:21:15 | new | This allocation cannot return null. $@ is unnecessary. | test.cpp:21:9:21:15 | new | This check |
|
||||
| test.cpp:29:13:29:24 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:30:7:30:13 | ... == ... | This check |
|
||||
| test.cpp:33:13:33:24 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:34:8:34:9 | p2 | This check |
|
||||
| test.cpp:37:13:37:24 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:38:7:38:16 | ... == ... | This check |
|
||||
| test.cpp:41:13:41:24 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:42:7:42:19 | ... == ... | This check |
|
||||
| test.cpp:45:13:45:24 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:46:7:46:8 | p5 | This check |
|
||||
| test.cpp:49:8:49:19 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:50:7:50:13 | ... == ... | This check |
|
||||
| test.cpp:53:8:53:19 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:54:8:54:9 | p7 | This check |
|
||||
| test.cpp:58:8:58:19 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:59:7:59:16 | ... == ... | This check |
|
||||
| test.cpp:63:8:63:19 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:64:7:64:19 | ... != ... | This check |
|
||||
| test.cpp:69:9:69:20 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:70:7:70:14 | ... != ... | This check |
|
||||
| test.cpp:75:11:75:22 | new[] | This allocation cannot return null. $@ is unnecessary. | test.cpp:76:13:76:15 | p11 | This check |
|
||||
| test.cpp:151:9:151:24 | new | This allocation cannot throw. $@ is unnecessary. | test.cpp:152:15:152:18 | { ... } | This catch block |
|
||||
| test.cpp:199:15:199:35 | new | This allocation cannot throw. $@ is unnecessary. | test.cpp:201:16:201:19 | { ... } | This catch block |
|
||||
|
||||
@@ -18,7 +18,7 @@ void *operator new(std::size_t, const std::nothrow_t &) noexcept;
|
||||
void *operator new[](std::size_t, const std::nothrow_t &) noexcept;
|
||||
|
||||
void bad_new_in_condition() {
|
||||
if (!(new int)) { // BAD [NOT DETECTED]
|
||||
if (!(new int)) { // BAD
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ void bad_new_missing_exception_handling() {
|
||||
if (p1 == 0)
|
||||
return;
|
||||
|
||||
int *p2 = new int[100]; // BAD [NOT DETECTED]
|
||||
int *p2 = new int[100]; // BAD
|
||||
if (!p2)
|
||||
return;
|
||||
|
||||
@@ -42,7 +42,7 @@ void bad_new_missing_exception_handling() {
|
||||
if (p4 == nullptr)
|
||||
return;
|
||||
|
||||
int *p5 = new int[100]; // BAD [NOT DETECTED]
|
||||
int *p5 = new int[100]; // BAD
|
||||
if (p5) {} else return;
|
||||
|
||||
int *p6;
|
||||
@@ -50,7 +50,7 @@ void bad_new_missing_exception_handling() {
|
||||
if (p6 == 0) return;
|
||||
|
||||
int *p7;
|
||||
p7 = new int[100]; // BAD [NOT DETECTED]
|
||||
p7 = new int[100]; // BAD
|
||||
if (!p7)
|
||||
return;
|
||||
|
||||
@@ -66,13 +66,13 @@ void bad_new_missing_exception_handling() {
|
||||
return;
|
||||
|
||||
int *p10;
|
||||
p10 = new int[100]; // BAD [NOT DETECTED]
|
||||
p10 = new int[100]; // BAD
|
||||
if (p10 != 0) {
|
||||
}
|
||||
|
||||
int *p11;
|
||||
do {
|
||||
p11 = new int[100]; // BAD [NOT DETECTED]
|
||||
p11 = new int[100]; // BAD
|
||||
} while (!p11);
|
||||
|
||||
int* p12 = new int[100];
|
||||
@@ -154,7 +154,7 @@ void bad_placement_new_with_exception_handling() {
|
||||
|
||||
void good_placement_new_with_exception_handling() {
|
||||
char buffer[1024];
|
||||
try { new (buffer) Foo(42); } // GOOD: Foo constructor might throw [FALSE POSITIVE]
|
||||
try { new (buffer) Foo(42); } // GOOD: Foo constructor might throw
|
||||
catch (...) { }
|
||||
}
|
||||
|
||||
@@ -179,17 +179,17 @@ void calls_non_throwing(int* p) {
|
||||
|
||||
void good_new_with_throwing_call() {
|
||||
try {
|
||||
int* p1 = new(std::nothrow) int; // GOOD [FALSE POSITIVE]
|
||||
int* p1 = new(std::nothrow) int; // GOOD
|
||||
may_throw();
|
||||
} catch(...) { }
|
||||
|
||||
try {
|
||||
int* p2 = new(std::nothrow) int; // GOOD [FALSE POSITIVE]
|
||||
int* p2 = new(std::nothrow) int; // GOOD
|
||||
Foo f(10);
|
||||
} catch(...) { }
|
||||
|
||||
try {
|
||||
int* p3 = new(std::nothrow) int; // GOOD [FALSE POSITIVE]
|
||||
int* p3 = new(std::nothrow) int; // GOOD
|
||||
calls_throwing_code(p3);
|
||||
} catch(...) { }
|
||||
}
|
||||
@@ -201,7 +201,7 @@ void bad_new_with_nonthrowing_call() {
|
||||
} catch(...) { }
|
||||
|
||||
try {
|
||||
int* p2 = new(std::nothrow) int; // GOOD: boolean conversion constructor might throw [FALSE POSITIVE]
|
||||
int* p2 = new(std::nothrow) int; // GOOD: boolean conversion constructor might throw
|
||||
Foo f(12);
|
||||
if(f) { }
|
||||
} catch(...) { }
|
||||
|
||||
Reference in New Issue
Block a user