[Lldb-commits] [lldb] [lldb] Check buffer allocation in DW_OP_piece empty-stack path (PR #207009)
Yao Qi via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 28 02:43:12 PDT 2026
================
@@ -1085,7 +1085,10 @@ static llvm::Error Evaluate_DW_OP_piece(EvalContext &eval_ctx,
// In a multi-piece expression, this means that the current piece is
// not available. Fill with zeros for now by resizing the data and
// appending it
- curr_piece.ResizeData(piece_byte_size);
+ if (curr_piece.ResizeData(piece_byte_size) != piece_byte_size)
----------------
qiyao wrote:
Good question, and I don't think there is an established policy. I'd rather not add a size constant here. Any threshold here would be a heuristic. Letting the allocator be the arbiter, ask for the buffer and report an error if we do not get it, is non-arbitrary and consistent with how the load-address piece path right below already handles.
https://github.com/llvm/llvm-project/blob/7e1719546578ed523f5deb4ac499cdc833280d9c/lldb/source/Expression/DWARFExpression.cpp#L1155
[lldb-dwarf-expression-fuzzer.cpp](lldb/tools/lldb-fuzzer/lldb-dwarf-expression-fuzzer/lldb-dwarf-expression-fuzzer.cpp) generates these values randomly, there is no constraints yet on the values it can generate.
https://github.com/llvm/llvm-project/pull/207009
More information about the lldb-commits
mailing list