public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applied] ir: Avoid infinite loop during type canonicalization
Date: Wed, 08 Sep 2021 16:23:37 +0200	[thread overview]
Message-ID: <87fsuff8nq.fsf@redhat.com> (raw)

Hello,

While looking at something else, I noticed an occurrence of infinite
loop during type canonicalization, especially when cancelling
canonical type propagation on some types.

Fixed thus.

This helps address https://bugzilla.redhat.com/show_bug.cgi?id=1951501

	* src/abg-ir-priv.h
	(environment::priv::collect_types_that_depends_on): Don't try to
	collect a type that has already been collected.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.

---
 src/abg-ir-priv.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/abg-ir-priv.h b/src/abg-ir-priv.h
index 9285dd73..f09162ab 100644
--- a/src/abg-ir-priv.h
+++ b/src/abg-ir-priv.h
@@ -607,6 +607,11 @@ struct environment::priv
     bool result = false;
     for (const auto i : types)
       {
+	// First avoid infinite loop if we've already collected the
+	// current type.
+	if (collected.find(i) != collected.end())
+	  continue;
+
 	type_base *t = reinterpret_cast<type_base*>(i);
 	if (t->priv_->depends_on_recursive_type(target))
 	  {
-- 
2.30.0


-- 
		Dodji


                 reply	other threads:[~2021-09-08 14:23 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=87fsuff8nq.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).