public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ssbssa at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/22594] Possible access to unintended variable in "gdb/stabsread.c" line 1364
Date: Tue, 07 Apr 2020 17:10:59 +0000	[thread overview]
Message-ID: <bug-22594-4717-0s875H3nC4@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-22594-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=22594

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to Petru-Florin Mihancea from comment #0)
> While experimenting with a CodeSonar plugin we develop, we noticed a
> potential bug in file "gdb/stabsread.c" line 1364, function define_symbol 
> 
> 1359           *typedef_sym = *sym;
> 1360           SYMBOL_ACLASS_INDEX (typedef_sym) = LOC_TYPEDEF;
> 1361           SYMBOL_VALUE (typedef_sym) = valu;
> 1362           SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN;
> 1363           if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
> 1364             TYPE_NAME (SYMBOL_TYPE (sym)) //HERE
> 1365               = obconcat (&objfile->objfile_obstack,
> 1366                           SYMBOL_LINKAGE_NAME (sym),
> 1367                           (char *) NULL);
> 1368           add_symbol_to_list (typedef_sym, &file_symbols);
> 
> Shouldn't typedef_sym be used instead of sym (and maybe also in the previous
> line)? A similar issue might be in line 1320.
> 
> Regards,
> Petru Florin Mihancea

Because of:
          *typedef_sym = *sym;

TYPE_NAME (SYMBOL_TYPE (sym)) and TYPE_NAME (SYMBOL_TYPE (typedef_sym)) are
equivalent, so it doesn't make a difference which one is used here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

       reply	other threads:[~2020-04-07 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-22594-4717@http.sourceware.org/bugzilla/>
2020-04-07 17:10 ` ssbssa at sourceware dot org [this message]
2020-04-07 18:24 ` tromey at sourceware dot org

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-22594-4717-0s875H3nC4@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).