public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Fix use-after-move bug in add_thread_object
Date: Thu, 11 Jul 2019 15:16:00 -0000	[thread overview]
Message-ID: <20190711151631.84783.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=72ee03ff58d954dbed886b672032c8c9db0a0dcc

commit 72ee03ff58d954dbed886b672032c8c9db0a0dcc
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Jul 11 09:09:52 2019 -0600

    Fix use-after-move bug in add_thread_object
    
    commit 05b08ac1608 ("Reduce manual reference counting in
    py-inferior.c") introduced a use-after-move bug in add_thread_object,
    causing a test suite failure.  This patch fixes the bug.
    
    Tested on x86-64 Fedora 29.
    
    gdb/ChangeLog
    2019-07-11  Tom Tromey  <tromey@adacore.com>
    
    	* python/py-inferior.c (add_thread_object): Don't use thread_obj
    	after it has been moved.

Diff:
---
 gdb/ChangeLog            | 5 +++++
 gdb/python/py-inferior.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 49ccba7..b5585b4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-11  Tom Tromey  <tromey@adacore.com>
+
+	* python/py-inferior.c (add_thread_object): Don't use thread_obj
+	after it has been moved.
+
 2019-07-10  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* valops.c (value_must_coerce_to_target): Change return type to
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index bf43012..2888222 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -344,7 +344,7 @@ add_thread_object (struct thread_info *tp)
     return;
 
   gdbpy_ref<> event = create_thread_event_object (&new_thread_event_object_type,
-						  (PyObject *) thread_obj.get ());
+						  (PyObject *) inf_obj);
   if (event == NULL
       || evpy_emit_event (event.get (), gdb_py_events.new_thread) < 0)
     gdbpy_print_stack ();


                 reply	other threads:[~2019-07-11 15:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190711151631.84783.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@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).