llvm-project
4012c1f6 - [lldb][test] Avoid out-of-bounds reads in TestConflictingSymbol.py (#172792)

Commit
3 days ago
[lldb][test] Avoid out-of-bounds reads in TestConflictingSymbol.py (#172792) Generic data variables are considered to be of the type `void *&`, see `ClangExpressionDeclMap::AddOneGenericVariable()`. On 64-bit platforms (e.g. AArch64), this type is 8 bytes long, while the `conflicting_symbol` variables are defined as `int`, which is typically 4 bytes. `test_conflicting_symbols` could fail if the next 4 bytes in the memory after any of the variables are not zero. This can be reproduced by adding a variable with a non-zero value after `conflicting_symbol`: ``` --- a/lldb/test/API/lang/c/conflicting-symbol/One/OneConstant.c +++ b/lldb/test/API/lang/c/conflicting-symbol/One/OneConstant.c @@ -1 +1,2 @@ int __attribute__ ((visibility("hidden"))) conflicting_symbol = 11111; +int guard = 1; ``` In this case, the test fails with: ``` AssertionError: Ran command: "expr (unsigned long long)conflicting_symbol" Got output: (unsigned long long) $0 = 4294978407 Expecting sub string: "11111" (was not found) Symbol from One should be found ``` Note that 4294978407 = 0x100002B67 = 1 * 2^32 + 11111.
Author
Parents
Loading