From a145e52fafd78fd20b82a399e76d0b70aee3a2e8 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Fri, 29 Aug 2025 10:45:55 +0200 Subject: [PATCH] C++: Add uninitialized local test --- .../CWE/CWE-457/semmle/tests/UninitializedLocal.expected | 2 ++ .../Security/CWE/CWE-457/semmle/tests/ms_vacopy.c | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 cpp/ql/test/query-tests/Security/CWE/CWE-457/semmle/tests/ms_vacopy.c diff --git a/cpp/ql/test/query-tests/Security/CWE/CWE-457/semmle/tests/UninitializedLocal.expected b/cpp/ql/test/query-tests/Security/CWE/CWE-457/semmle/tests/UninitializedLocal.expected index 6773f5aef94..af507e045ff 100644 --- a/cpp/ql/test/query-tests/Security/CWE/CWE-457/semmle/tests/UninitializedLocal.expected +++ b/cpp/ql/test/query-tests/Security/CWE/CWE-457/semmle/tests/UninitializedLocal.expected @@ -1,6 +1,7 @@ edges nodes | errors.cpp:13:7:13:7 | definition of x | semmle.label | definition of x | +| ms_vacopy.c:4:13:4:15 | definition of va2 | semmle.label | definition of va2 | | test.cpp:11:6:11:8 | definition of foo | semmle.label | definition of foo | | test.cpp:111:6:111:8 | definition of foo | semmle.label | definition of foo | | test.cpp:226:7:226:7 | definition of x | semmle.label | definition of x | @@ -16,6 +17,7 @@ nodes | test.cpp:479:6:479:6 | definition of x | semmle.label | definition of x | #select | errors.cpp:14:18:14:18 | x | errors.cpp:13:7:13:7 | definition of x | errors.cpp:13:7:13:7 | definition of x | The variable $@ may not be initialized at this access. | errors.cpp:13:7:13:7 | x | x | +| ms_vacopy.c:5:13:5:15 | va2 | ms_vacopy.c:4:13:4:15 | definition of va2 | ms_vacopy.c:4:13:4:15 | definition of va2 | The variable $@ may not be initialized at this access. | ms_vacopy.c:4:13:4:15 | va2 | va2 | | test.cpp:12:6:12:8 | foo | test.cpp:11:6:11:8 | definition of foo | test.cpp:11:6:11:8 | definition of foo | The variable $@ may not be initialized at this access. | test.cpp:11:6:11:8 | foo | foo | | test.cpp:113:6:113:8 | foo | test.cpp:111:6:111:8 | definition of foo | test.cpp:111:6:111:8 | definition of foo | The variable $@ may not be initialized at this access. | test.cpp:111:6:111:8 | foo | foo | | test.cpp:227:3:227:3 | x | test.cpp:226:7:226:7 | definition of x | test.cpp:226:7:226:7 | definition of x | The variable $@ may not be initialized at this access. | test.cpp:226:7:226:7 | x | x | diff --git a/cpp/ql/test/query-tests/Security/CWE/CWE-457/semmle/tests/ms_vacopy.c b/cpp/ql/test/query-tests/Security/CWE/CWE-457/semmle/tests/ms_vacopy.c new file mode 100644 index 00000000000..4aef7d79eb5 --- /dev/null +++ b/cpp/ql/test/query-tests/Security/CWE/CWE-457/semmle/tests/ms_vacopy.c @@ -0,0 +1,8 @@ +#include + +int va_copy_test(va_list va) { + va_list va2; + va_copy(va2, va); + return 0; +} +// semmle-extractor-options: --microsoft