Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>,
	Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
Subject: Re: [PATCH] Fix access to uninitialized variable in fill_in_stop_func
Date: Thu, 08 Aug 2019 17:42:00 -0000	[thread overview]
Message-ID: <20190808104200.6a387ac8@f29-4.lan> (raw)
In-Reply-To: <87lfw360lt.fsf@tromey.com>

On Thu, 08 Aug 2019 11:14:22 -0600
Tom Tromey <tom@tromey.com> wrote:

> >>>>> "Pedro" == Pedro Franco de Carvalho <pedromfc@linux.ibm.com> writes:  
> 
> Pedro> This patch changes fill_in_stop_func to check the return value of
> Pedro> find_pc_partial_function before accessing the block pointer that is only
> Pedro> written by find_pc_partial_function if it returns a success status.  
> 
> Pedro> gdb/ChangeLog:
> Pedro> YYYY-MM-DD  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>  
> 
> Pedro> 	* infrun.c (fill_in_stop_func): Use return value of
> Pedro> 	find_pc_partial_function, remove comment.  
> 
> The comment for find_pc_partial_function says:
> 
>    nullptr is used as a return value for *BLOCK if no block is found. 
> 
> ... which implies to me that the function was intended to set *BLOCK
> unconditionally.  Perhaps Kevin could say, as I think he added the block
> parameter.

Yes, that was the intent, but unfortunately, that's not what's happening.

find_pc_partial_function contains the following return path...

  if (msymbol.minsym == NULL)
    {
      /* No available symbol.  */
      if (name != NULL)
	*name = 0;
      if (address != NULL)
	*address = 0;
      if (endaddr != NULL)
	*endaddr = 0;
      return 0;
    }

...which does not set *BLOCK.

I think I'd prefer to see...

      if (block != nullptr)
	*block = nullptr;

...added to find_pc_partial_function instead.

Kevin


  reply	other threads:[~2019-08-08 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 13:54 Pedro Franco de Carvalho
2019-08-08 17:14 ` Tom Tromey
2019-08-08 17:42   ` Kevin Buettner [this message]
2019-08-09 19:13     ` Pedro Franco de Carvalho
2019-08-09 19:17       ` Kevin Buettner
2019-08-09 19:52         ` Pedro Franco de Carvalho
2019-08-09 20:42       ` Tom Tromey

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=20190808104200.6a387ac8@f29-4.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedromfc@linux.ibm.com \
    --cc=tom@tromey.com \
    /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