Skip to content

Commit

Permalink
contrib/elf2dmp: Use lduw_le_p() to read PDB
Browse files Browse the repository at this point in the history
The relevant value may be unaligned and is little-endian.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20240307-elf2dmp-v4-13-4f324ad4d99d@daynix.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
akihikodaki authored and pm215 committed Mar 11, 2024
1 parent 6679094 commit 2aa501a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/elf2dmp/pdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "qemu/osdep.h"
#include "qemu/bswap.h"

#include "pdb.h"
#include "err.h"
Expand Down Expand Up @@ -186,7 +187,7 @@ static bool pdb_init_symbols(struct pdb_reader *r)

r->symbols = symbols;

r->segments = *(uint16_t *)((const char *)symbols + sizeof(PDB_SYMBOLS) +
r->segments = lduw_le_p((const char *)symbols + sizeof(PDB_SYMBOLS) +
symbols->module_size + symbols->offset_size +
symbols->hash_size + symbols->srcmodule_size +
symbols->pdbimport_size + symbols->unknown2_size +
Expand Down

0 comments on commit 2aa501a

Please sign in to comment.