From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1036.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so9547768pjm.2 for ; Sun, 11 Dec 2022 05:21:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=cQANkCzBkBdDlr3/lLOmKjpmsPTaG0ZPdJDigRZaT2A=; b=aO/zybLvhAWOdgVgS5FuvYz9dTnlhtx3jophsdQTfrHAcyVgRt0aVzA2i1UKyCT15Z HznY7/zZCyWWwX49HuYCYShlxy9E8EFzjDQZePrudNBqfhjjNe25GtlxKuIgp0r/qTPA avnOU81TdsMMfjwDE/bu19W8EC7OSilQbo88edJWfrJsnrK1ge9fiC/1p29Sw06bpJ5S QZ6RvHGAFcxOhj4Ajggacw21CizLQvVWUAFTW0xIVc+01bFA1twHq2x7YUD+uhROgIUp rygwePhuGj0V5NuUDdIehvTDh5Jqpgo1+8K11sVz4PajT5TJMkWTHHubASMtxLP2VrHU Wo8g== 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-Google-Smtp-Source: AA0mqf7zcU7gvPRm934k/9F7t/3IxJbCU1ab21aIxFQCeskjOjrVnrPi/dlNBOfn39Mlg0eyg9zuCw== 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 From: Alan Modra To: binutils@sourceware.org Subject: PR29870, objdump SEGV in display_debug_lines_decoded dwarf.c:5524 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 List-Id: 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); -- Alan Modra Australia Development Lab, IBM