[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 08/13] contrib/elf2dmp: Use lduw_le_p() to read PDB
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 08/13] contrib/elf2dmp: Use lduw_le_p() to read PDB |
Date: |
Tue, 5 Mar 2024 13:32:20 +0000 |
On Tue, 5 Mar 2024 at 07:36, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> This resolved UBSan warnings.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> contrib/elf2dmp/pdb.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c
> index 1c5051425185..492aca4434c8 100644
> --- a/contrib/elf2dmp/pdb.c
> +++ b/contrib/elf2dmp/pdb.c
> @@ -19,6 +19,7 @@
> */
>
> #include "qemu/osdep.h"
> +#include "qemu/bswap.h"
>
> #include "pdb.h"
> #include "err.h"
> @@ -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 +
Same comment still applies as on v1 version of this patch.
thanks
-- PMM
- [PATCH v2 04/13] contrib/elf2dmp: Conform to the error reporting pattern, (continued)
- [PATCH v2 05/13] contrib/elf2dmp: Always check for PA resolution failure, Akihiko Odaki, 2024/03/05
- [PATCH v2 03/13] contrib/elf2dmp: Continue even contexts are lacking, Akihiko Odaki, 2024/03/05
- [PATCH v2 12/13] contrib/elf2dmp: Use GPtrArray, Akihiko Odaki, 2024/03/05
- [PATCH v2 08/13] contrib/elf2dmp: Use lduw_le_p() to read PDB, Akihiko Odaki, 2024/03/05
- Re: [PATCH v2 08/13] contrib/elf2dmp: Use lduw_le_p() to read PDB,
Peter Maydell <=
- [PATCH v2 13/13] contrib/elf2dmp: Clamp QEMU note to file size, Akihiko Odaki, 2024/03/05
- [PATCH v2 07/13] contrib/elf2dmp: Ensure segment fits in file, Akihiko Odaki, 2024/03/05
- [PATCH v2 09/13] contrib/elf2dmp: Use rol64() to decode, Akihiko Odaki, 2024/03/05
- [PATCH v2 11/13] contrib/elf2dmp: Build only for little endian host, Akihiko Odaki, 2024/03/05
- [PATCH v2 06/13] contrib/elf2dmp: Always destroy PA space, Akihiko Odaki, 2024/03/05
- [PATCH v2 10/13] MAINTAINERS: Add Akihiko Odaki as a elf2dmp reviewer, Akihiko Odaki, 2024/03/05