From patchwork Thu Jun 10 08:28:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 43808 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 A74713AAA0B0 for ; Thu, 10 Jun 2021 08:28:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A74713AAA0B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623313719; bh=C/Zq1ZCAd2V/DJe3WloppsdkCv8ma4yHy5FKtSgehUM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=gNZLhEGG7c8zkC4S94RiSVgXaSztz1Gg5Ht+L6gIZ3E6049fJk5/jisDY9riNL0/0 PTU3ZUErO9QrQF0vXM7Q3vqir7rtGIrp74XoueAOUwKxk9xyGk9U5sLclpGH8rfrW0 Pl6dzdZyliC4Bb6U8KjFgIsUdVPWn0tIO6bwlCoo= 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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id A967F386103A for ; Thu, 10 Jun 2021 08:28:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A967F386103A Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-U36W5bHeMzequhUeOnCguA-1; Thu, 10 Jun 2021 04:28:33 -0400 X-MC-Unique: U36W5bHeMzequhUeOnCguA-1 Received: by mail-wm1-f69.google.com with SMTP id k5-20020a05600c1c85b02901ac8b854c50so2775723wms.5 for ; Thu, 10 Jun 2021 01:28:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:organization:date:message-id :user-agent:mime-version; bh=C/Zq1ZCAd2V/DJe3WloppsdkCv8ma4yHy5FKtSgehUM=; b=dhcG7mTVhWWTwCv62dnLoQJ5CDHe26CX29rRsCVT4V1dM1VGhqwCi51t9mVrv1yVFp +T7QAGyVsSOQK2u1PoH5oAtKCdNUfbch4SkVDPR7q1InJeyPIPQRbIbFUFv9Gjg8O1xD hetqNyLONOsqWMolUMKE7qYaBNv49FVBfJHymjW6/KDIGmHEu3FS9enmIOmbAZIoAE0w 9kNRFVgXFNXfRTDno3rUiRllxI30OqCKCDKu0r3U7JYg3+rzpGNNmXcDZohsjDnaxO0g gourexssvdfBPXTTv2w4LmTaJQfUGK594oA/lDt0ya8JhYBVnZ7zYuogn9XGCSQA4xPF j1UQ== X-Gm-Message-State: AOAM530Fk5t3TZfHoLf5vhMnpviXd4hkJZYQWJF6I48Ankf97/CdkkG0 NtuRWSqobor9t2shpk/B5Neic/HwI5Tz94gKAmljRUlYAP5YdBh1MtE4wxB0WDmNw2+qx+8Usci x2o4wRTVFFSLfjPptr4af4ngJvUw359hf5vihVQijRjOPWT2VmuBq8cefIjXnjTh3LHh4 X-Received: by 2002:a05:6000:232:: with SMTP id l18mr3960127wrz.88.1623313711665; Thu, 10 Jun 2021 01:28:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVoSfk9fwqbBNPUFNVXYZ24XBarVNvBD0gk2v2yLcRNrD7FzM9ztJ7f2uynn2A9eUmWaiO9Q== X-Received: by 2002:a05:6000:232:: with SMTP id l18mr3960104wrz.88.1623313711353; Thu, 10 Jun 2021 01:28:31 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id e27sm2749419wra.50.2021.06.10.01.28.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 01:28:31 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 0C9E25800FF; Thu, 10 Jun 2021 10:28:29 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] location:expand() shouldn't crash when no location manager available Organization: Red Hat / France X-Operating-System: Fedora 35 X-URL: http://www.redhat.com Date: Thu, 10 Jun 2021 10:28:29 +0200 Message-ID: <87v96m2keq.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=-11.8 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 debugging, I noticed that trying to expand location not yet associated with any location manager would crash. This patch fixes that. * src/abg-ir.cc (location::expand): When no location manager is present, just expand to an empty location. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-ir.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 0f909b3d..f0be0843 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -321,7 +321,16 @@ public: void location::expand(std::string& path, unsigned& line, unsigned& column) const { - ABG_ASSERT(get_location_manager()); + if (!get_location_manager()) + { + // We don't have a location manager maybe because this location + // was just freshly instanciated. We still want to be able to + // expand to default values. + path = ""; + line = 0; + column = 0; + return; + } get_location_manager()->expand_location(*this, path, line, column); }