public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 1/3] Add virtual destructor to dwarf2_per_cu_data
Date: Mon,  3 May 2021 13:32:04 -0600	[thread overview]
Message-ID: <20210503193206.4008066-2-tromey@adacore.com> (raw)
In-Reply-To: <20210503193206.4008066-1-tromey@adacore.com>

Address sanitizer pointed out that the patch to use 'delete' for
dwarf2_per_cu_data introduced a bug -- now it is possible to delete a
signatured_type using a pointer to its base class.  This patch fixes
the problem by introducing a virtual destructor.

gdb/ChangeLog
2021-05-03  Tom Tromey  <tromey@adacore.com>

	* dwarf2/read.h (dwarf2_per_cu_data): Add virtual destructor.
---
 gdb/ChangeLog     | 4 ++++
 gdb/dwarf2/read.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 80f0e3ee13b..f514b8316ec 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -418,6 +418,8 @@ struct dwarf2_per_cu_data
   {
   }
 
+  virtual ~dwarf2_per_cu_data () = default;
+
   /* The start offset and length of this compilation unit.
      NOTE: Unlike comp_unit_head.length, this length includes
      initial_length_size.
-- 
2.26.3


  reply	other threads:[~2021-05-03 19:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 19:32 [PATCH 0/3] Fix some sanitizer errors Tom Tromey
2021-05-03 19:32 ` Tom Tromey [this message]
2021-05-04 15:34   ` [PATCH 1/3] Add virtual destructor to dwarf2_per_cu_data Tom Tromey
2021-05-06 17:23     ` Tom Tromey
2021-05-03 19:32 ` [PATCH 2/3] Fix buffer underflow in add_path Tom Tromey
2021-05-06 14:53   ` Tom de Vries
2021-05-03 19:32 ` [PATCH 3/3] Fix ubsan build Tom Tromey
2021-05-17 18:53 ` [PATCH 0/3] Fix some sanitizer errors 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=20210503193206.4008066-2-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@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).