public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applied] dwarf-reader: Make die_peel_{qual_ptr,typedef} always set peeled type
Date: Fri, 02 Dec 2022 17:15:10 +0100	[thread overview]
Message-ID: <87359xu6i9.fsf@redhat.com> (raw)

Hello,

When die_peel_{qual_ptr,typedef} don't actually peel anything, they
don't set the peeled type output argument.  So callers expecting that
argument to be set can be surprised by the fact the peeled argument
might not be set.

	* src/abg-dwarf-reader.cc (die_peel_qual_ptr, die_peel_typedef):
	If the function returned true, then set the peeled argument even
	if the function hasn't peeled anything.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the master branch.
---
 src/abg-dwarf-reader.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 5523d229..e18f111b 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -7136,6 +7136,8 @@ die_peel_qual_ptr(Dwarf_Die *die, Dwarf_Die& peeled_die)
   else
     return false;
 
+  memcpy(&peeled_die, die, sizeof(peeled_die));
+
   while (tag == DW_TAG_const_type
 	 || tag == DW_TAG_volatile_type
 	 || tag == DW_TAG_restrict_type
@@ -7167,6 +7169,8 @@ die_peel_typedef(Dwarf_Die *die, Dwarf_Die& peeled_die)
 
   int tag = dwarf_tag(die);
 
+  memcpy(&peeled_die, die, sizeof(peeled_die));
+
   if (tag == DW_TAG_typedef)
     {
       if (!die_die_attribute(die, DW_AT_type, peeled_die))
-- 
2.31.1


-- 
		Dodji


                 reply	other threads:[~2022-12-02 16:15 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=87359xu6i9.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=libabigail@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).