public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vijunag at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug corefiles/13652] New: 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
Date: Thu, 02 Feb 2012 04:29:00 -0000	[thread overview]
Message-ID: <bug-13652-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-02-02  4:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02  4:29 vijunag at gmail dot com [this message]
2012-02-02  4:56 ` [Bug corefiles/13652] " vijunag at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-13652-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).