diff options
author | Steven Wu <stevenwu@apple.com> | 2019-12-18 12:22:21 -0800 |
---|---|---|
committer | Steven Wu <stevenwu@apple.com> | 2019-12-18 12:22:21 -0800 |
commit | 9366397f057d18401e680b2cb28a0ee17c59d4a6 (patch) | |
tree | b38630861dac5521dc8097edd13f46f157668d37 /libunwind | |
parent | 3f966867001213a56fccdb01c03a63bb5441e91d (diff) | |
download | llvm-9366397f057d18401e680b2cb28a0ee17c59d4a6.tar.gz |
[libunwind] Fix evaluating DWARF operation DW_OP_pick
reg is unsigned type and used here for getting array element from the end by
negating it. negation of unsigned can result in large number and array access
with that index will result in segmentation fault.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=43872
Patched by: kamlesh kumar
Differential Revision: https://reviews.llvm.org/D69893
Diffstat (limited to 'libunwind')
-rw-r--r-- | libunwind/src/DwarfInstructions.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libunwind/src/DwarfInstructions.hpp b/libunwind/src/DwarfInstructions.hpp index 48ef1866d6e1..ee98f538d437 100644 --- a/libunwind/src/DwarfInstructions.hpp +++ b/libunwind/src/DwarfInstructions.hpp @@ -433,7 +433,7 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace, // pick from reg = addressSpace.get8(p); p += 1; - value = sp[-reg]; + value = sp[-(int)reg]; *(++sp) = value; if (log) fprintf(stderr, "duplicate %d in stack\n", reg); |