1Upstream-Status: Inappropriate [embedded specific]
2
3Fix problem during parsing of ELF headers for 64bit on big-endian.
4Some header fields were read with wrong size.
5
62014/10/24
7Par Olsson <Par.Olsson@windriver.com>
8Shan Hai <shan.hai@windriver.com>
9
10diff --git a/readelflib.c b/readelflib.c
11index 3f5b25b..0bf0de3 100644
12--- a/readelflib.c
13+++ b/readelflib.c
14@@ -261,8 +261,8 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
15   int i;
16   unsigned int j;
17   Elf64_Addr loadaddr;
18-  unsigned int dynamic_addr;
19-  size_t dynamic_size;
20+  Elf64_Addr dynamic_addr;
21+  Elf64_Xword dynamic_size;
22   char *program_interpreter;
23
24   Elf64_Ehdr *elf_header;
25@@ -311,7 +311,7 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
26 	    error (0, 0, _("more than one dynamic segment\n"));
27
28 	  dynamic_addr = read64(segment->p_offset, be);
29-	  dynamic_size = read32(segment->p_filesz, be);
30+	  dynamic_size = read64(segment->p_filesz, be);
31 	  break;
32
33 	case PT_INTERP:
34@@ -329,11 +329,11 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
35 	  break;
36
37 	case PT_NOTE:
38-	  if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4)
39+	  if (!*osversion && read64(segment->p_filesz, be) >= 32 && read64(segment->p_align, be) >= 4)
40 	    {
41 	      Elf64_Word *abi_note = (Elf64_Word *) (file_contents
42 						     + read64(segment->p_offset, be));
43-	      Elf64_Addr size = read32(segment->p_filesz, be);
44+	      Elf64_Xword size = read64(segment->p_filesz, be);
45
46 	      while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16
47 		     || read32(abi_note [2], be) != 1
48