]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
elf*_xlatetom: do not check ELF_T_NHDR has integer number of records
authorPetr Machata <pmachata@redhat.com>
Tue, 17 Jul 2012 14:29:18 +0000 (16:29 +0200)
committerPetr Machata <pmachata@redhat.com>
Tue, 17 Jul 2012 14:29:18 +0000 (16:29 +0200)
See this bug report for more details:
  https://bugzilla.redhat.com/show_bug.cgi?id=835877

Signed-off-by: Petr Machata <pmachata@redhat.com>
libelf/ChangeLog
libelf/elf32_xlatetom.c

index 89dd35f544543e45aee3a6a1bc30c307a6a8cf01..0a6bcba75f3ba07a1913a21e1a6aab179b42e60c 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-17  Petr Machata  <pmachata@redhat.com>
+
+       * elf32_xlatetom.c (elfw2(LIBELFBITS, xlatetom)): Do not check for
+       integer number of records in case of ELF_T_NHDR.
+
 2012-04-02  Mark Wielaard  <mjw@redhat.com>
 
        * elf32_offscn.c: Do not match SHT_NOBITS sections at OFFSET unless
index 8fdf09d7e09feb583345eb0878c050c45cb95a8a..368df078eac2c88ce1a44ebb02fd95251bb976e2 100644 (file)
@@ -1,5 +1,5 @@
 /* Convert from file to memory representation.
-   Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+   Copyright (C) 1998, 1999, 2000, 2002, 2012 Red Hat, Inc.
    This file is part of elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 1998.
 
@@ -59,7 +59,11 @@ elfw2(LIBELFBITS, xlatetom) (dest, src, encode)
 #endif
 
 
-  if (src->d_size % recsize != 0)
+  /* We shouldn't require integer number of records when processing
+     notes.  Payload bytes follow the header immediately, it's not an
+     array of records as is the case otherwise.  */
+  if (src->d_type != ELF_T_NHDR
+      && src->d_size % recsize != 0)
     {
       __libelf_seterrno (ELF_E_INVALID_DATA);
       return NULL;