From patchwork Sun Dec 11 13:21:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 32188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1765143wrr; Sun, 11 Dec 2022 05:21:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5oRi/Awp7jjt6w5Ab5bGLRoEVs8D4xerD45jgAjn8D50O1x7hjmPUDbxu1c92eUrHPN/O3 X-Received: by 2002:a05:6402:c7:b0:461:97ed:fbb6 with SMTP id i7-20020a05640200c700b0046197edfbb6mr9924590edu.29.1670764917106; Sun, 11 Dec 2022 05:21:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670764917; cv=none; d=google.com; s=arc-20160816; b=mx+xwqXgHxV5sUb7X8SnLgmozc7GkpUaAInvBHXPK3fedWqnSenQZbGlnyX0294iSY L+y75TBk3GryhYD63yPysRR6FN0Fpb/v6kZag5kIRTt0VU4FqugRNoDKFgJ2PfuW7MiR 946QYlGB49xkL7zRTKjG8EhhNS4FowZsKQko2ByjS6unib8vk1Iy3vGv7WmcOTit0+Yc mBFuC45iEvH0CDkaA1rbgftVsMcu6Q7vnF9eD7kYrf8GrISOzZpITtdWMHq/xSVwJG4U 8EEW67wf6iPTzEne3RgF/u1sdC6NQT6F2lhk4lol1aq8Gb4KMOUTQ6oSS12Zi9b1M/LT Uptg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=cQANkCzBkBdDlr3/lLOmKjpmsPTaG0ZPdJDigRZaT2A=; b=xTmXO4/ws+Uyp+hpIz3Lot8gQluvzmqNbep285qnUMUwtGLIi+vbqPLCe87NktPix5 jA2XrrvkYLhixaclLvy2E/BVeIgQJ5DkhNSPfFHvmNJx5VoJ/h/zb9i4U1dD04A1q4IP kCJhtQVP7OxED0EToGbQLE2xpZZ18x/UoudseYxbqOl2QGcJsgSP+YFVDZxrUd277seI 7cNuOGLTS3AazewVNYBwH8KsniXuUoxhqIA97ifPu/keGPomCu8AWXfT3RwmKnXfN3jA hC17Gurv5PO4ATKcKfqlLs+jY0/8aJjlsu/repAsiPcz5nIoDlpeO9WNlYBzp7OFKhql ZdHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=WyRSxiZ+; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id qo9-20020a170907212900b007aac98ec3dfsi3171786ejb.303.2022.12.11.05.21.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Dec 2022 05:21:57 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=WyRSxiZ+; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DF3263900D1C for ; Sun, 11 Dec 2022 13:21:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF3263900D1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670764915; bh=cQANkCzBkBdDlr3/lLOmKjpmsPTaG0ZPdJDigRZaT2A=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WyRSxiZ+VaDX7eJZe8sXYGbQujxrYOxiIrF1b8Wf/jXQiFN57c227++NCGdRMhQru 3nE9H5/Qadccq6sb9M2XP2Xl/U389mou1xnJJnFkqsZlctR+3Av2RueGE1gS5LCz7s do/nUMvwdSxRPpID4QSc7W2Ow4wauCelFGKUFZ3U= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 3330338187F2 for ; Sun, 11 Dec 2022 13:21:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3330338187F2 Received: by mail-pj1-x1036.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so9547768pjm.2 for ; Sun, 11 Dec 2022 05:21:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cQANkCzBkBdDlr3/lLOmKjpmsPTaG0ZPdJDigRZaT2A=; b=Jbn66BiXzRz5gppdf2DjJQBNeFXGqOmgXzMJDZacFahL9rPf5BIhLt2dgS2z/1shMa eTrjbgz+4uygfIlnEf8/RFVWZlZmetOGoYlIzwITXUM5CO9rvvrOocqPySRKV+qYQJKi U7lXHo+B7+h4A4DwWJ0LuxyRe/1iev/CSq/2oZed5GVxCXSohy7OulCQYmhlneTuf9um K2zxj4Y2zMN8Ehq38s8stqEaYus6Ya1kdkTReWKpkt9DM1UVFcLNtJHLCu3LXGm7b3A0 VRLx7QnMd1p9uxC4xiVY2d8SP3+cR/YuiAEnmEd5DoAgZxC7idnx8ptkUahD5HEmaPv3 izZQ== X-Gm-Message-State: ANoB5pmAiLpIaJVwFQRX2DD8r6XDt56fcLbmL2OZDzCHdkDR8JyXmhRE j8XOPUwYdzt/XhCdXS9hnuqdABRVJeI= X-Received: by 2002:a05:6a20:3d29:b0:a7:9629:7d61 with SMTP id y41-20020a056a203d2900b000a796297d61mr18427502pzi.20.1670764905878; Sun, 11 Dec 2022 05:21:45 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:323f:3eba:1ec9:7cf8]) by smtp.gmail.com with ESMTPSA id c197-20020a624ece000000b005745788f44csm3999788pfb.124.2022.12.11.05.21.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Dec 2022 05:21:45 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 39979114046D; Sun, 11 Dec 2022 23:51:42 +1030 (ACDT) Date: Sun, 11 Dec 2022 23:51:42 +1030 To: binutils@sourceware.org Subject: PR29870, objdump SEGV in display_debug_lines_decoded dwarf.c:5524 Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3035.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751923993765818076?= X-GMAIL-MSGID: =?utf-8?q?1751923993765818076?= DWARF5 directory and file table allow more opportunity for fuzzers to break things. There are likely other places in dwarf.c that should be fixed too. PR 29870 * dwarf.c (display_debug_lines_decoded): Handle NULL file_table name entry. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index ffe3c10ff75..6ec33725876 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -5499,7 +5499,7 @@ display_debug_lines_decoded (struct dwarf_section * section, || (xop == DW_LNS_copy)) { const unsigned int MAX_FILENAME_LENGTH = 35; - char *fileName; + char *fileName = NULL; char *newFileName = NULL; size_t fileNameLength; @@ -5518,7 +5518,7 @@ display_debug_lines_decoded (struct dwarf_section * section, else fileName = (char *) file_table[indx].name; } - else + if (!fileName) fileName = _(""); fileNameLength = strlen (fileName);