Message ID | 20230913224657.11606-6-viktor@daynix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | elf2dmp: improve Win2022, Win11 and large dumps | expand |
On 2023/09/14 7:46, Viktor Prutyanov wrote: > PDB for Windows 11 kernel has slightly different structure compared to > previous versions. Since elf2dmp don't use the other fields, copy only > 'segments' field from PDB_STREAM_INDEXES. I suggest replacing the sidx member of struct pdb_reader with a single uint16_t to save some space and prevent accidentally introducing references to other members.
diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index adcfa7e154..2ef873b13e 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp/pdb.c @@ -188,15 +188,11 @@ static int pdb_init_symbols(struct pdb_reader *r) r->symbols = symbols; - if (symbols->stream_index_size != sizeof(PDB_STREAM_INDEXES)) { - err = 1; - goto out_symbols; - } - - memcpy(sidx, (const char *)symbols + sizeof(PDB_SYMBOLS) + + sidx->segments = *(uint16_t *)((const char *)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size + symbols->offset_size + symbols->hash_size + symbols->srcmodule_size + - symbols->pdbimport_size + symbols->unknown2_size, sizeof(*sidx)); + symbols->pdbimport_size + symbols->unknown2_size + + offsetof(PDB_STREAM_INDEXES, segments)); /* Read global symbol table */ r->modimage = pdb_ds_read_file(r, symbols->gsym_file);
PDB for Windows 11 kernel has slightly different structure compared to previous versions. Since elf2dmp don't use the other fields, copy only 'segments' field from PDB_STREAM_INDEXES. Signed-off-by: Viktor Prutyanov <viktor@daynix.com> --- contrib/elf2dmp/pdb.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)