We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0e3369f commit 6a7b2e4Copy full SHA for 6a7b2e4
cpp/ql/test/query-tests/Security/CWE/CWE-193/test.cpp
@@ -848,4 +848,15 @@ void test16_with_malloc(size_t index) {
848
int* newname = (int*)malloc(size);
849
newname[index] = 0; // $ SPURIOUS: alloc=L848 deref=L849 // GOOD [FALSE POSITIVE]
850
}
851
+}
852
+
853
+# define MyMalloc(size) malloc(((size) == 0 ? 1 : (size)))
854
855
+void test_regression(size_t size) {
856
+ int* p = (int*)MyMalloc(size + 1);
857
+ int* chend = p + (size + 1);
858
859
+ if(p <= chend) {
860
+ *p = 42; // BAD [NOT DETECTED]
861
+ }
862
0 commit comments