From patchwork Tue Aug 25 05:14:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 142152 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B0AA14BA7999 for ; Tue, 25 Aug 2026 05:14:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0AA14BA7999 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=tMTHHyCl X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 5F03E4BA23E6 for ; Tue, 25 Aug 2026 05:14:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F03E4BA23E6 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5F03E4BA23E6 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787634859; cv=none; b=mMQDYpSxcB+F4VP0JT3hzgSk/WZA1JTVQnsql8aoBv+20q0Cr9/WXXsxQTRB8bxr2htNj8jXpaXuSfLfjk5ikXvsJEQD8B+hDwqZ10IgLCCtUgpLwZfXqXbMTyC1Mzc9V7XXbBwCilm4OOWHPL2fUgt14BK2JjaVy5UZrgz2a78= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787634859; c=relaxed/simple; bh=+EaEs0tHqREkTwhBBFvSI3gP1/YLxMuTyLTOH5eJKQ0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=wgWmU7fu958zUuLn4SgKRFd7HFN7Ul/18E+3EBQgALx2drRJdqQzJd7B2hNEaeolwl5QL1vcjDeKmBdtAroHKOttRIrp50WwQF+bZPIBlBLCpxtgLxPwXM039xHyAOuDDOyt0hpCmtMsfHeHUKxgTZ4A66PSnaGh7NN8AsorBDY= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=tMTHHyCl DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F03E4BA23E6 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-383b4a3755fso4767847a91.3 for ; Mon, 24 Aug 2026 22:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787634858; x=1788239658; darn=sourceware.org; h=content-disposition:content-type:mime-version:message-id:subject:to :from:date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=DLTLhPzG0hXHiawqodrRB2QeowVInU0VirtpNyaLJ5E=; b=tMTHHyClxnTGaTpOvm0xDaDmJYZJktA6Ky9EqFn0lZ8efXthF1GnS/3Yhov2T4WH38 qV3u0F3Yc53mrgKgDU48iJGr86Aducidxff0K520Ab5jbhdE3LjMzL//fqUNjMrjqOY/ 1RqUBUl6cZ8KqGe2DWMqvCGpotPtxA60IvDLfjNWI8Z5Tgy601ATCTqtMfZ+JfFhs1/a fB6igy7TlY+Jbw6wzgt1uJEziOug4aqFxXBDd1bAawQcjXPkEJbsC5wJzWNBj2en0RcP oOIEPcU025jpNC0/mTw3cndzjNq/hCSs8sJ7aHyAN6rlXjsUXPvwLtxklYC9jKCHkYxM yhFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787634858; x=1788239658; h=content-disposition:content-type:mime-version:message-id:subject:to :from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DLTLhPzG0hXHiawqodrRB2QeowVInU0VirtpNyaLJ5E=; b=Fvs4E+GhP9cswLufvsLBOvxxkHHDMWZ6t9p19WjG6SzFl97wz8QDrVOuPpNVM+yRyL KzR7Mo4IW1l1bNvDbskIWJOUfDaJH3o4YJxGq1ejXJPe35e69fNxozGwbJs+3KKAxIZ9 4CCDyllrLGdR/YwqM1D6C9H2fLvVhSaCBIj2Y4ouZPa4mn6kUM5pVQrwokC8jWPwmYG4 gvc0I8Hu1rtmFqlBKPGQ0KuSFMCDzp/HBneGI7yLO4D56U3LGlaI/3irTpaFG9tEpnHd vDF2Z6PjGsqr1LtdkAHUWlpzLmCiMiGjiFbUnAth3TwawkRiJ6anDnc5bQNJhH3jXa5I +TlA== X-Gm-Message-State: AFuF++nrof3/BF1Jo6YM8UFCt5hEhRywfgZ+BzJ2/qDvCr8sLLGO4+hT W7T7xbIoVArzmGeFhIh6BXQEPBvXvtX4YEsh1/K6yQAKIvan1gqkI9ImvZkrFA== X-Gm-Gg: AR+sD13kwb7vOvgSOCJB5ZYQVcZV3pq3UHHOr/b+8uHJ3gWxTopzNznW1Ej2LeacbZI kiOF7Tlq6Ac0+0WVjsxM/9Alf4Mc1PTqqEz5bZkX7CRgYo9lMWxCtyrRw7yz38tHNyo+Me4E6Pv a9IodHFLvmw3iqG276Mn15iGyMr3vZYBD3DmkNQGLQ7c+xbUHAkoXKLU2gBUb+6zEyZ0pv6zcdZ JS51p3aVWk0l8OhHRgWftaorwXenc1TwIYMbV1PG2FQmwrJf8J2OmZwQANiij3FOLMHBtxJndHe LEVL4JUoUSPwxmxbPD+AUz7fovk/MdMVX8ZggrT4w2f3SLQglis2l9YB3EjNgpkyujRt6dWuob3 3x8CAW64Nj0O7JRO6JHOUn9Jm5QmcMjYwRufwVMVPbZ0HeFAKDw2HjMHaN3GMUf0YHoHz3DYOum O9hpcqCUI4tsYup5bJu57uBGEuS+ZqAcLpX8cTefwvRvRMpo2+d7B/iNu3Ro3oBF0DG5UgYkbD8 jjGoAO8nCCvFdkN6wNqQWcTQhEZokKMM2ZpQG1M X-Received: by 2002:a17:90b:28ce:b0:38e:70d5:b12d with SMTP id 98e67ed59e1d1-396463997e2mr8682697a91.6.1787634858190; Mon, 24 Aug 2026 22:14:18 -0700 (PDT) Received: from squeak.grove.modra.org (58-96-106-158.ip4.superloop.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3965a55e658sm516309a91.3.2026.08.24.22.14.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 22:14:17 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id B16D71140BEA; Tue, 25 Aug 2026 14:44:14 +0930 (ACST) Date: Tue, 25 Aug 2026 14:44:14 +0930 From: Alan Modra To: binutils@sourceware.org Subject: [RFC] PR 34481 arbitrary limit on decompressed size of .dwo files Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3029.6 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 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org PR34481 exposes a failure of a heuristic in bfd_section_size_insane dealing with compressed sections. The assumption there is that a compressed section would not be more than ten times the total file size. This of course is foolish since one highly compressed section can easily exceed ten times the total file size. However, it mostly worked for real object files. The claim in pr34481 is that the limit has been hit for .dwo files in a real C++ codebase. I don't find that claim unbelievable. While we could work around the .dwo problem with the following patch, I'm inclined to simply remove the whole "size / 10 > filesize" block. My reasoning is that this is anti-fuzzer code. If we allow a .dwo hole then the anti-fuzzer code may as well not be there. Fuzzers will soon find the hole. What do you all think? * section.c (bfd_section_size_insane): Do not attempt to limit .dwo section sizes. diff --git a/bfd/section.c b/bfd/section.c index 457486b0f89..13cb2fdeb2d 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1774,11 +1774,17 @@ bfd_section_size_insane (bfd *abfd, asection *sec) "int aaa..a;" with "a" repeated enough times can result in compression ratios without limit for .debug_str, whereas such a file will usually also have the enormous symbol - uncompressed in .symtab. */ + uncompressed in .symtab. PR34481: For separare dwarf info + files we won't have a .symtab section so can't make any + assumptions about decompressed section sizes. */ if (size / 10 > filesize) { - bfd_set_error (bfd_error_bad_value); - return true; + size_t len = strlen (sec->name); + if (len < 4 || memcmp (sec->name + len - 4, ".dwo", 4) != 0) + { + bfd_set_error (bfd_error_bad_value); + return true; + } } size = sec->compressed_size; }