[lldb] GetOpcodeDataSize misparses DW_OP_implicit_pointer operands
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
`DW_OP_implicit_pointer` has a reference-sized operand followed by a signed LEB128 offset. The reference is four bytes in DWARF32 and eight bytes in DWARF64, independently of the target address size.
LLDB currently calls `Skip_LEB128` at the beginning of the reference operand and then adds the target address size:
```cpp
data.Skip_LEB128(&offset);
return (dwarf_cu ? dwarf_cu->GetAddressByteSize() : 4) + offset - data_offset;
```
This both uses the wrong width for the reference and decodes the SLEB128 from the wrong position. Expression scanners can consequently resume in the middle of an operand and interpret operand bytes as opcodes.
The reference width should come from the containing unit's DWARF32/DWARF64 format, and the SLEB128 should be skipped only after the complete reference.
Contributor guide
Research direction
Start at LLDB's GetOpcodeDataSize handling for DW_OP_implicit_pointer and inspect how the containing DWARF compilation unit exposes its DWARF32 or DWARF64 format. Verify that scanning accounts for the complete reference before the signed LEB128 offset; done means expression scanning resumes after both operands for either format, independently of target address size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100