From patchwork Tue Aug 22 02:23:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 74427 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 690E93858439 for ; Tue, 22 Aug 2023 02:23:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 690E93858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692671036; bh=oXGxBhX1KX1V3lHzX9+0XNP3irBFO+SIfwmoV4n2/ZI=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=wOUHCBCwU/U4nI5+KWj3bf5HbS/Fr5hPqDb9HVq1CtjMRGKOB/iIb+PDKeueLgvzm Dfuf3j99wVe90ZK2y87U7eEZHEUTXnpGxPbFzNqNU+0K9BJKoOGqgA5tz16i2TGp1E /YCG+1d9ic7bhh4ULDKYgw1ul0ivw34IQW9OylZM= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id 7DE7F3858D33 for ; Tue, 22 Aug 2023 02:23:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7DE7F3858D33 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3a76cbd4bbfso2964357b6e.3 for ; Mon, 21 Aug 2023 19:23:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692671003; x=1693275803; 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=oXGxBhX1KX1V3lHzX9+0XNP3irBFO+SIfwmoV4n2/ZI=; b=d5nbkQ3yUx0EWe1sn8QBbnXZZRvaIq0eqmgV/gpjjeMXytHzkkNz6X/js4Ae6zh/Ar p2cNZ85DV1+JgwCX2a/7XWDHF9SejQtABN/fPMTxQeerSWHlYiFlx1VdPmoYBndifhIp 1Uy+zlXQs3PVwoKgPHx9+qIvgWsCukVtdAAUq7DNLBcppTd5fpLeksZ5h6ZjJSm3y1xw 7j37r5T3SIONBkAmIfnT/2HcUtpbZpRQKtu+pTrwBQMie3xkA0IRiyX76pvEAC8yagry qd2K3NylxC5j1Xe8YS9kF2KwBPYkVCPVrma3gbGFA0GIjEj2dQk+Yyxtf2nSu5Xc/2uP dDSw== X-Gm-Message-State: AOJu0YwdfKMybtaSwOVpFgasnM230hvJ/MrdW75ym6aqvOvpC0FSfpIY tbvyjH4OqnRuTmL2zN0+y8LoklfcD+4= X-Google-Smtp-Source: AGHT+IFjcprlkN2HIR5Hm+guAJhI85C5ONT8vZ5nDW0Z5fP1gG10CZzkFnQfXXN7808JRuM1O7CH2A== X-Received: by 2002:a05:6808:c:b0:3a3:6360:ffbe with SMTP id u12-20020a056808000c00b003a36360ffbemr9734500oic.24.1692671003279; Mon, 21 Aug 2023 19:23:23 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id bm2-20020a056a00320200b0068a2d78890fsm4614057pfb.10.2023.08.21.19.23.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 19:23:22 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 407EE11423DC; Tue, 22 Aug 2023 11:53:20 +0930 (ACST) Date: Tue, 22 Aug 2023 11:53:20 +0930 To: binutils@sourceware.org Subject: objdump: file name table entry count check Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3034.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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+patchwork=sourceware.org@sourceware.org Sender: "Binutils" Fuzzers have found that objdump -W takes a really long time if the entry count uleb is ridiculously large, and format attributes don't consume data (which doesn't make sense for a table of names). * dwarf.c (display_formatted_table): Sanity check count of table entries. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 4f695bf2bca..3ebc45ae373 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -4313,10 +4313,10 @@ display_formatted_table (unsigned char *data, printf (_("\n The %s is empty.\n"), table_name); return data; } - else if (data >= end) + else if (data >= end + || data_count > (size_t) (end - data)) { - warn (_("%s: Corrupt entry count - expected %#" PRIx64 - " but none found\n"), table_name, data_count); + warn (_("%s: Corrupt entry count %#" PRIx64 "\n"), table_name, data_count); return data; }