]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libelf/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 19 Dec 2010 03:40:29 +0000 (04:40 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 19 Dec 2010 03:40:29 +0000 (04:40 +0100)
* elf_getdata_rawchunk.c (elf_getdata_rawchunk): Fix off64_t overflow
when MAXIMUM_SIZE == ~0.

libelf/elf_getdata_rawchunk.c

index 5af0f7f3989485dfd2a0e9437c3f9bc296e04075..0932f973defcec986dfd6de4e6909690d7253b01 100644 (file)
@@ -78,8 +78,9 @@ elf_getdata_rawchunk (elf, offset, size, type)
       return NULL;
     }
 
-  if (unlikely (size > elf->maximum_size
-               || (off64_t) (elf->maximum_size - size) < offset))
+  if (unlikely (elf->maximum_size != ~((size_t) 0)
+               && (size > elf->maximum_size
+                   || (off64_t) (elf->maximum_size - size) < offset)))
     {
       /* Invalid request.  */
       __libelf_seterrno (ELF_E_INVALID_OP);