Fix corrupted debug header directory entry when writing multiple such entries #869

Merged
vitek-karas merged 1 commit from FixDebugEntryWriting into master 2022-09-29 16:06:58 -05:00
vitek-karas commented 2022-07-14 04:47:46 -05:00 (Migrated from github.com)

Basically the first two entries are written correctly, and any after that which has data will have the RVA correct, but the virtual address field will be wrong. Depending on the consumer this can work (if they use RVA) or fail (if they use virtual address) as they would read garbage data.

Currently this mostly affects embedded protable PDBs since in that case we write 4 headers: CodeView, PdbChecksum, EmbeddedPdb and Deterministic (in this order), so the embedded PDB data is effectively wrong.

Also adds a test which validates that both the RVA and virtual address point to the same thing.

This fixes https://github.com/jbevain/cecil/issues/856 (I tried something very similar to the small repro posted in that issue)

/cc @tom-englert

Basically the first two entries are written correctly, and any after that which has data will have the RVA correct, but the virtual address field will be wrong. Depending on the consumer this can work (if they use RVA) or fail (if they use virtual address) as they would read garbage data. Currently this mostly affects embedded protable PDBs since in that case we write 4 headers: CodeView, PdbChecksum, EmbeddedPdb and Deterministic (in this order), so the embedded PDB data is effectively wrong. Also adds a test which validates that both the RVA and virtual address point to the same thing. This fixes https://github.com/jbevain/cecil/issues/856 (I tried something very similar to the small repro posted in that issue) /cc @tom-englert
tom-englert commented 2022-07-14 09:08:26 -05:00 (Migrated from github.com)

👍

:+1:
jbevain commented 2022-09-29 16:06:53 -05:00 (Migrated from github.com)

Good catch, thanks @vitek-karas!

Good catch, thanks @vitek-karas!
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-jbevain/cecil!869
No description provided.