angr / angr/cle

Wrong lookups for DWARF v5 filename

オープン
#548 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Python
スター
485
フォーク
135
平均マージ
2日 2時間
マージ済み PR(30日)
15

説明

### Description

I think I've found a bug in (edit 1/20/25: ~~pyelftools/examples/dwarf_decode_address.py~~) https://github.com/angr/cle/blob/master/cle/backends/elf/elf.py that leads to wrong filenames retrievals from DWARF v5 data.
I believe the "- 1" here:

`line 668: file_entry = lineprog.header["file_entry"][line.state.file - 1]`

should be a "- 0" when processing DWARF v5. (In the example I was looking at, the index became -1, which wrapped around to the last entry, giving a wrong filename.)

cle uses pyelftools. Here's an example directly from the pyelftools repo that gives me the answer I expect: https://github.com/eliben/pyelftools/blob/main/examples/dwarf_decode_address.py

From that example, here's the difference in logic from the cle implementation:
```
line 83: delta = 1 if lineprog.header.version < 5 else 0
line 92: filename = lineprog['file_entry'][prevstate.file - delta].name
```

### Steps to reproduce the bug

_No response_

### Environment

_No response_

### Additional context

_No response_

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。