From patchwork Wed Sep 8 14:23:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 44908 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 308D4385842C for ; Wed, 8 Sep 2021 14:23:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 308D4385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631111025; bh=iE54HcFJN3em616ibj2bsrzs3dD1zni8yWHC6kIvLMo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=GJx0saxd+pM1bkUW/qyqBByiTAPThsfM0Y57hne5tCGy8HaPkG56VMABLoT0vujhF ENbqZxOHgKLiTFuNnFZyu+J73W9xA3ao7HlxzftGzzpUvDE6cL38YuNCNO9r0TryGu 16P3fvMdKTowczQZBsa9vUj2uGtZ6ODNDSeUWWEM= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 32E1A3858414 for ; Wed, 8 Sep 2021 14:23:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 32E1A3858414 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-449-TvpGHKu0PjK2eFqkGuu53g-1; Wed, 08 Sep 2021 10:23:39 -0400 X-MC-Unique: TvpGHKu0PjK2eFqkGuu53g-1 Received: by mail-wm1-f72.google.com with SMTP id y188-20020a1c7dc5000000b002e80e0b2f87so1154376wmc.1 for ; Wed, 08 Sep 2021 07:23:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:organization:date:message-id :user-agent:mime-version; bh=iE54HcFJN3em616ibj2bsrzs3dD1zni8yWHC6kIvLMo=; b=DBjRFMp4TPBxHuFYvjh21TnPfbigjncXS9XJi+ERoFgd5ORMGV4CqjyDYOne9BzI4i TcvBJQDwU2aMZ9aks+Vgb1HCn9EszrpHBwnpIaM9VLsmfWy1h4fMxjPHdjmUxCuNOfV2 G5EaXhnPZehsg69DsfEt+Ho5XEmepVpL/uAmfDZyINRuDEguXfTYiesENqrO7K+PH8Rj ucUqHWePN9YEqtpWbv71DBd/JlDIqIeOmMcD8sWAVBRa2N9tM1n6OstUIlmOXUvECxls gv28aOXXjKsMTM2lxsoyhzpUtDtIljlvrsW+MLKpri61VaF+GLgPknz8vY233C6BuviD qWtQ== X-Gm-Message-State: AOAM530uMKEZeZSsj/p17oFsaIYcWq2ZXEHBEGMFSQKOBttoRJcKXDmR SCincBhKwjYIG7nQYbv64I/CiSs9D5+zHo94cJ0b32KUyc5fwZuI8bTam4l2VIqNGa8NrberZKS hhDa/z12ugylvewYDASWOttgnkGpphRD7CKOPd8lIDET1vYgYH7V+2jeIjSSgrOKIWP7+ X-Received: by 2002:adf:fd92:: with SMTP id d18mr4460664wrr.28.1631111018413; Wed, 08 Sep 2021 07:23:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEpYHaeigluB63UaByCjutka6Xslqs/EHHX1eDcRlBrJy4PBGRDoc4hMMx5pRMyCJNLbVoKA== X-Received: by 2002:adf:fd92:: with SMTP id d18mr4460639wrr.28.1631111018198; Wed, 08 Sep 2021 07:23:38 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id l16sm2551619wrh.44.2021.09.08.07.23.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 07:23:37 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 90D7758000E; Wed, 8 Sep 2021 16:23:37 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Avoid infinite loop during type canonicalization Organization: Red Hat / France X-Operating-System: Fedora 36 X-URL: http://www.redhat.com Date: Wed, 08 Sep 2021 16:23:37 +0200 Message-ID: <87fsuff8nq.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" 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 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(i); if (t->priv_->depends_on_recursive_type(target)) {