This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug corefiles/13652] New: non elf core file whose whose size isgreater than zero && u.u_dsize == 0 && u.u_ssize == 0 are being recognized astad-core


http://sourceware.org/bugzilla/show_bug.cgi?id=13652

             Bug #: 13652
           Summary: non elf core file whose whose size is greater than
                    zero && u.u_dsize == 0 && u.u_ssize == 0 are being
                    recognized as tad-core
           Product: gdb
           Version: 6.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: corefiles
        AssignedTo: unassigned@sourceware.org
        ReportedBy: vijunag@gmail.com
    Classification: Unclassified


In tradcore target format checking i.e. in
trad_unix_core_file_p() magic is not being used to validate if core matches 
tradcore target.

If for eg sizeof(u) == u and if u.u_dsize ==0 && u.u_ssize == 0
then core file is being recognized as tradcore target instead of checking
for the magic numbers u.magic.

if (bfd_seek (abfd, (file_ptr) TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
    return 0;
#endif

  val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd);
  if (val != sizeof u)
    {   
      /* Too small to be a core file */
      bfd_set_error (bfd_error_wrong_format);
      return 0;
    }   

  /* Sanity check perhaps??? */
  if (u.u_dsize > 0x1000000)  /* Remember, it's in pages...  */
    {   
      bfd_set_error (bfd_error_wrong_format);
      return 0;
    }   
  if (u.u_ssize > 0x1000000)
    {
      bfd_set_error (bfd_error_wrong_format);
      return 0;
    }

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]