[lldb] [llvm] [DWARF] Fix arity of DW_OP_bra (PR #114136)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 15:14:59 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
@llvm/pr-subscribers-lldb
Author: Jonas Devlieghere (JDevlieghere)
<details>
<summary>Changes</summary>
Found by my POC DWARF expression evaluation fuzzer.
---
Full diff: https://github.com/llvm/llvm-project/pull/114136.diff
2 Files Affected:
- (modified) lldb/unittests/Expression/DWARFExpressionTest.cpp (+3)
- (modified) llvm/include/llvm/BinaryFormat/Dwarf.def (+1-1)
``````````diff
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index f9e0605fce29d6..fdc9bfae1876c5 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -181,6 +181,9 @@ TEST(DWARFExpression, DW_OP_bra) {
}),
// clang-format on
llvm::HasValue(0x42));
+
+ EXPECT_THAT_ERROR(Evaluate({DW_OP_bra, 0x01, 0x00}).takeError(),
+ llvm::Failed());
}
TEST(DWARFExpression, DW_OP_convert) {
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index 9336f2a454ae47..0cbbbe823c06b5 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -728,7 +728,7 @@ HANDLE_DW_OP(0x24, shl, 0, 2, 2, DWARF)
HANDLE_DW_OP(0x25, shr, 0, 2, 2, DWARF)
HANDLE_DW_OP(0x26, shra, 0, 2, 2, DWARF)
HANDLE_DW_OP(0x27, xor, 0, 2, 2, DWARF)
-HANDLE_DW_OP(0x28, bra, 1, 0, 2, DWARF)
+HANDLE_DW_OP(0x28, bra, 1, 1, 2, DWARF)
HANDLE_DW_OP(0x29, eq, 0, 2, 2, DWARF)
HANDLE_DW_OP(0x2a, ge, 0, 2, 2, DWARF)
HANDLE_DW_OP(0x2b, gt, 0, 2, 2, DWARF)
``````````
</details>
https://github.com/llvm/llvm-project/pull/114136
More information about the llvm-commits
mailing list