diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-04-07 15:57:37 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-04-26 13:06:36 +0000 |
commit | bb8bd71deb85ce7818fa747c3297d4b0ed7cf367 (patch) | |
tree | fdb700765325c665dc68a8e4b0b7e1f307db3541 /libdwfl | |
parent | dd25560eb6973014066321821060b5cec18204a4 (diff) |
Avoid signed/unsigned comparison
Some compilers implicitly cast the result of uint_fast16_t *
uint_fast16_t to something signed and then complain about the
comparison to (unsigned) size_t.
Casting phnum to size_t is a good idea anyway as 16bit multiplication
can easily overflow and we are not checking for this.
Change-Id: I073202d433d75b540ca042d15c364187a08fec6c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'libdwfl')
-rw-r--r-- | libdwfl/ChangeLog | 4 | ||||
-rw-r--r-- | libdwfl/elf-from-memory.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 76359e20..f605f466 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,5 +1,9 @@ 2017-04-20 Ulf Hermann <ulf.hermann@qt.io> + * elf-from-memory.c: Explicitly cast phnum to size_t. + +2017-04-20 Ulf Hermann <ulf.hermann@qt.io> + * libdwflP.h: Don't include config.h. * argp-std.c: Include config.h. * cu.c: Likewise. diff --git a/libdwfl/elf-from-memory.c b/libdwfl/elf-from-memory.c index dd42e954..12a0a1be 100644 --- a/libdwfl/elf-from-memory.c +++ b/libdwfl/elf-from-memory.c @@ -172,7 +172,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma, { /* Read in the program headers. */ - if (initial_bufsize < phnum * phentsize) + if (initial_bufsize < (size_t)phnum * phentsize) { unsigned char *newbuf = realloc (buffer, phnum * phentsize); if (newbuf == NULL) |