From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 1635E3858D35 for ; Wed, 4 Jan 2023 13:25:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1635E3858D35 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-x1029.google.com with SMTP id o2so30569412pjh.4 for ; Wed, 04 Jan 2023 05:25:08 -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=EyRFmT64/VfYt7H9ne0RKWxcJFtzI9Hb7yw/BPgWiU4=; b=RxJhCqg4wZbq8MKSj5kRA1CW0RTVlxPJy8h6oM1KzVFRdOREAWm0PI81WfdPz7nRJY 7g7IELp3aU6Dr0wUIN8Add6w0UEVRpJFUIE868Ii919T4wgsUP+uIoi2nM8oQsv0jGrz 81arwaI7IqLCXZNNBMpPNa7Bg1uwPv0ekblQxAU6dAUZfe5kagojNiDcjz88QHdwVLNc 0We4lNhYNAG2IUt+QmdsxxG1cs8RenQl2JXx1VIsiXHsLdJZF6HNkDA3SYqPae9rZWpd 40gVlOtTu1tz7AhyXHbytfGaKfa3+NVVxDyxVXJpmyg5QUuJrVItj7g6KOX6AiqB6SnF iFrg== 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=EyRFmT64/VfYt7H9ne0RKWxcJFtzI9Hb7yw/BPgWiU4=; b=MQryz+yRcJnjKcPx0MdrVTExzH730smWffKY+yUS8jfT4fY+hTnEiQ7pgK1P20I+nu aOQUehLadoN1gW5LzvizeJhhSK2UDfg280qEGrtiaMRb68hgDL3kmnCuUTkplmMLNpYZ 5l65rldTFBWQc7jq+v3JAH0/tr4evLQY50teEodWEH6A+D2LdJMXTud5pVA3MSaypFA3 668LqQCsApVoG/zlGzj+IBSKHnt98QHnq5f//8g/nZHkyTatg1AJdRCBALz4Hd5jNQHT POjmwkBB87Pf9Gs+UqyKmvbRDki46oP5yrlHEUgb5UgEbnhPdiBglYzA2LZcLBvCgmLs 688w== X-Gm-Message-State: AFqh2koHSw1husNfHWXeeR7DnvAlU2c7DBHiKUBiAulnt52SsGCyK0Uy yOJSPq0r7UIUiFYY/rsKX0gsbC0dtwg= X-Google-Smtp-Source: AMrXdXuN7ucxpF/SLblBWOIlSvpZ+IaE3ycJgZ68TCVCYthYLvYj6Exkzl6YHtOMvQrFbq4CSMF79g== X-Received: by 2002:a17:903:2441:b0:192:748f:d5a7 with SMTP id l1-20020a170903244100b00192748fd5a7mr41653147pls.0.1672838707055; Wed, 04 Jan 2023 05:25:07 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:934:e2e8:56f6:280a]) by smtp.gmail.com with ESMTPSA id q11-20020a170902a3cb00b0018099c9618esm24305929plb.231.2023.01.04.05.25.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 05:25:06 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 557991142D30; Wed, 4 Jan 2023 23:55:04 +1030 (ACDT) Date: Wed, 4 Jan 2023 23:55:04 +1030 From: Alan Modra To: binutils@sourceware.org Subject: addr2line out of memory on fuzzed file Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3035.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 List-Id: Another case of fuzzers finding the section size sanity checks are avoided with SHT_NOBITS sections. * dwarf2.c (read_section): Check that the DWARF section being read has contents. diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 6eb6e04e6e5..f689eebbd88 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -705,6 +705,14 @@ read_section (bfd *abfd, return false; } + if ((msec->flags & SEC_HAS_CONTENTS) == 0) + { + _bfd_error_handler (_("DWARF error: section %s has no contents"), + section_name); + bfd_set_error (bfd_error_no_contents); + return false; + } + if (_bfd_section_size_insane (abfd, msec)) { /* PR 26946 */ -- Alan Modra Australia Development Lab, IBM