diff --git a/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/ReturnStackAllocatedMemory.expected b/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/ReturnStackAllocatedMemory.expected index b7b598a13c5..6aa457b1e8a 100644 --- a/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/ReturnStackAllocatedMemory.expected +++ b/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/ReturnStackAllocatedMemory.expected @@ -43,6 +43,11 @@ edges | test.cpp:189:16:189:16 | p | test.cpp:189:16:189:16 | (reference to) | | test.cpp:190:10:190:13 | (reference dereference) | test.cpp:190:10:190:13 | (reference to) | | test.cpp:190:10:190:13 | pRef | test.cpp:190:10:190:13 | (reference dereference) | +| test.cpp:237:12:237:17 | call to alloca | test.cpp:237:12:237:17 | call to alloca | +| test.cpp:237:12:237:17 | call to alloca | test.cpp:238:9:238:9 | p | +| test.cpp:249:13:249:20 | call to strndupa | test.cpp:249:13:249:20 | call to strndupa | +| test.cpp:249:13:249:20 | call to strndupa | test.cpp:250:9:250:10 | s2 | +| test.cpp:250:9:250:10 | s2 | test.cpp:250:9:250:10 | (void *)... | nodes | test.cpp:17:9:17:11 | & ... | semmle.label | & ... | | test.cpp:17:10:17:11 | mc | semmle.label | mc | @@ -101,6 +106,14 @@ nodes | test.cpp:190:10:190:13 | (reference dereference) | semmle.label | (reference dereference) | | test.cpp:190:10:190:13 | (reference to) | semmle.label | (reference to) | | test.cpp:190:10:190:13 | pRef | semmle.label | pRef | +| test.cpp:237:12:237:17 | call to alloca | semmle.label | call to alloca | +| test.cpp:237:12:237:17 | call to alloca | semmle.label | call to alloca | +| test.cpp:238:9:238:9 | p | semmle.label | p | +| test.cpp:245:9:245:15 | call to strdupa | semmle.label | call to strdupa | +| test.cpp:249:13:249:20 | call to strndupa | semmle.label | call to strndupa | +| test.cpp:249:13:249:20 | call to strndupa | semmle.label | call to strndupa | +| test.cpp:250:9:250:10 | (void *)... | semmle.label | (void *)... | +| test.cpp:250:9:250:10 | s2 | semmle.label | s2 | #select | test.cpp:17:9:17:11 | CopyValue: & ... | test.cpp:17:10:17:11 | mc | test.cpp:17:9:17:11 | & ... | May return stack-allocated memory from $@. | test.cpp:17:10:17:11 | mc | mc | | test.cpp:25:9:25:11 | Load: ptr | test.cpp:23:18:23:19 | mc | test.cpp:25:9:25:11 | ptr | May return stack-allocated memory from $@. | test.cpp:23:18:23:19 | mc | mc | @@ -115,3 +128,6 @@ nodes | test.cpp:177:10:177:23 | Convert: (void *)... | test.cpp:176:25:176:34 | localArray | test.cpp:177:10:177:23 | (void *)... | May return stack-allocated memory from $@. | test.cpp:176:25:176:34 | localArray | localArray | | test.cpp:183:10:183:19 | CopyValue: (reference to) | test.cpp:182:21:182:27 | myLocal | test.cpp:183:10:183:19 | (reference to) | May return stack-allocated memory from $@. | test.cpp:182:21:182:27 | myLocal | myLocal | | test.cpp:190:10:190:13 | CopyValue: (reference to) | test.cpp:189:16:189:16 | p | test.cpp:190:10:190:13 | (reference to) | May return stack-allocated memory from $@. | test.cpp:189:16:189:16 | p | p | +| test.cpp:238:9:238:9 | Load: p | test.cpp:237:12:237:17 | call to alloca | test.cpp:238:9:238:9 | p | May return stack-allocated memory from $@. | test.cpp:237:12:237:17 | call to alloca | call to alloca | +| test.cpp:245:9:245:15 | Call: call to strdupa | test.cpp:245:9:245:15 | call to strdupa | test.cpp:245:9:245:15 | call to strdupa | May return stack-allocated memory from $@. | test.cpp:245:9:245:15 | call to strdupa | call to strdupa | +| test.cpp:250:9:250:10 | Convert: (void *)... | test.cpp:249:13:249:20 | call to strndupa | test.cpp:250:9:250:10 | (void *)... | May return stack-allocated memory from $@. | test.cpp:249:13:249:20 | call to strndupa | call to strndupa | diff --git a/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp b/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp index 6818300d10d..44afcd7ee5f 100644 --- a/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp +++ b/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp @@ -235,17 +235,17 @@ void *alloca(size_t); void* test_alloca() { void* p = alloca(10); - return p; // BAD [NOT DETECTED] + return p; // BAD } char *strdupa(const char *); char *strndupa(const char *, size_t); char* test_strdupa(const char* s) { - return strdupa(s); // BAD [NOT DETECTED] + return strdupa(s); // BAD } void* test_strndupa(const char* s, size_t size) { char* s2 = strndupa(s, size); - return s2; // BAD [NOT DETECTED] + return s2; // BAD } \ No newline at end of file