Subversion Repositories Kolibri OS

Rev

Rev 5197 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5197 Rev 6324
Line 1... Line 1...
1
/* ELF core file support for BFD.
1
/* ELF core file support for BFD.
2
   Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007,
-
 
3
   2008, 2010 Free Software Foundation, Inc.
2
   Copyright (C) 1995-2015 Free Software Foundation, Inc.
Line 4... Line 3...
4
 
3
 
Line 5... Line 4...
5
   This file is part of BFD, the Binary File Descriptor library.
4
   This file is part of BFD, the Binary File Descriptor library.
6
 
5
 
Line 187... Line 186...
187
     count is in the first section header.  */
186
     count is in the first section header.  */
188
  if (i_ehdrp->e_shoff != 0 && i_ehdrp->e_phnum == PN_XNUM)
187
  if (i_ehdrp->e_shoff != 0 && i_ehdrp->e_phnum == PN_XNUM)
189
    {
188
    {
190
      Elf_External_Shdr x_shdr;
189
      Elf_External_Shdr x_shdr;
191
      Elf_Internal_Shdr i_shdr;
190
      Elf_Internal_Shdr i_shdr;
192
      bfd_signed_vma where = i_ehdrp->e_shoff;
191
      file_ptr where = (file_ptr) i_ehdrp->e_shoff;
193
 
-
 
194
      if (where != (file_ptr) where)
-
 
195
	goto wrong;
-
 
Line 196... Line 192...
196
 
192
 
197
      /* Seek to the section header table in the file.  */
193
      /* Seek to the section header table in the file.  */
198
      if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0)
194
      if (bfd_seek (abfd, where, SEEK_SET) != 0)
Line 199... Line 195...
199
	goto fail;
195
	goto fail;
200
 
196
 
201
      /* Read the first section header at index 0, and convert to internal
197
      /* Read the first section header at index 0, and convert to internal
Line 216... Line 212...
216
     It ought to be good enough to just read the last one.  */
212
     It ought to be good enough to just read the last one.  */
217
  if (i_ehdrp->e_phnum > 1)
213
  if (i_ehdrp->e_phnum > 1)
218
    {
214
    {
219
      Elf_External_Phdr x_phdr;
215
      Elf_External_Phdr x_phdr;
220
      Elf_Internal_Phdr i_phdr;
216
      Elf_Internal_Phdr i_phdr;
221
      bfd_signed_vma where;
217
      file_ptr where;
Line 222... Line 218...
222
 
218
 
223
      /* Check that we don't have a totally silly number of
219
      /* Check that we don't have a totally silly number of
224
	 program headers.  */
220
	 program headers.  */
225
      if (i_ehdrp->e_phnum > (unsigned int) -1 / sizeof (x_phdr)
221
      if (i_ehdrp->e_phnum > (unsigned int) -1 / sizeof (x_phdr)
226
	  || i_ehdrp->e_phnum > (unsigned int) -1 / sizeof (i_phdr))
222
	  || i_ehdrp->e_phnum > (unsigned int) -1 / sizeof (i_phdr))
Line 227... Line 223...
227
	goto wrong;
223
	goto wrong;
228
 
-
 
229
      where = i_ehdrp->e_phoff + (i_ehdrp->e_phnum - 1) * sizeof (x_phdr);
-
 
230
      if (where != (file_ptr) where)
224
 
231
	goto wrong;
225
      where = (file_ptr)(i_ehdrp->e_phoff + (i_ehdrp->e_phnum - 1) * sizeof (x_phdr));
Line 232... Line 226...
232
      if ((bfd_size_type) where <= i_ehdrp->e_phoff)
226
      if ((bfd_size_type) where <= i_ehdrp->e_phoff)
233
	goto wrong;
227
	goto wrong;
234
 
228
 
235
      if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0)
229
      if (bfd_seek (abfd, where, SEEK_SET) != 0)
236
	goto fail;
230
	goto fail;