[Lldb-commits] [lldb] 75b37c3 - [DWARF] Fix arity of DW_OP_bra (#114136)

via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 29 16:41:05 PDT 2024


Author: Jonas Devlieghere
Date: 2024-10-29T16:41:01-07:00
New Revision: 75b37c3191254d0c418058cb94c3a7922b7ba71e

URL: https://github.com/llvm/llvm-project/commit/75b37c3191254d0c418058cb94c3a7922b7ba71e
DIFF: https://github.com/llvm/llvm-project/commit/75b37c3191254d0c418058cb94c3a7922b7ba71e.diff

LOG: [DWARF] Fix arity of DW_OP_bra (#114136)

Found by my proof-of-concept DWARF expression evaluator fuzzer.

Added: 
    

Modified: 
    lldb/unittests/Expression/DWARFExpressionTest.cpp
    llvm/include/llvm/BinaryFormat/Dwarf.def

Removed: 
    


################################################################################
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)


        


More information about the lldb-commits mailing list