[Lldb-commits] [lldb] [llvm] [DWARF] Fix arity of DW_OP_bra (PR #114136)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 29 15:14:27 PDT 2024
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/114136
Found by my POC DWARF expression evaluation fuzzer.
>From b4f93c43634ac4a20693da560522f3b13a516ac7 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Tue, 29 Oct 2024 15:13:19 -0700
Subject: [PATCH] [DWARF] Fix arity of DW_OP_bra
---
lldb/unittests/Expression/DWARFExpressionTest.cpp | 3 +++
llvm/include/llvm/BinaryFormat/Dwarf.def | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
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