From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id B84A93857C58 for ; Wed, 17 Aug 2022 07:08:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B84A93857C58 Received: by mail-pl1-x633.google.com with SMTP id m2so11274772pls.4 for ; Wed, 17 Aug 2022 00:08:24 -0700 (PDT) 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; bh=CxdQm3FDtQKUUbnqVE9bYVDREy1cKvU7cl/rQlMT0R8=; b=Y7V9EngmcJx8pOTmteK0YU4IBwZWBnFYWvmbSC4RNc+/CNxhXJnFpqZ/3ZAahW9cy0 gDBv74VYNmJlQmJwmNSWKx7XwGoktu++uvbuv/z1ryYnXy1qRjsJ/AFdi/7oEaCLxges BBFDbxBDsjoMDHdm02Fj3c1O4QnVY8ypQXo9rxWfSV8SquF7dJsCQue8xUXzcc4A2cv3 Mq4vtsCXZTz0ORLkw0g57AlUXOCzmvr5VZXW3MBwR7SDOWeNhOamKEZWzOLVP5T/0s4u frkzP5Vf1G5aEtE/651M4WmtLrGFjRBJS4W6DdPHkHFGGF7hnf6FB24rZvSKePBc3Q9w l6TQ== X-Gm-Message-State: ACgBeo3b9jUbQd4k5+lJ/+LZvxN9zWZYKT6GlxZpPUxD4lwBoiBerPOY l/ufTi6ZAeNKSSAyMgDBH4J1nAVMiks= X-Google-Smtp-Source: AA6agR7C7CUa7xTOZ/4cVtN4RqPU0Ou5NtNsQ8InJzfivZ9DyLpkBxglcoKQamrnQb22+Ss34eBhHg== X-Received: by 2002:a17:902:8548:b0:171:5092:195f with SMTP id d8-20020a170902854800b001715092195fmr25101038plo.146.1660720103723; Wed, 17 Aug 2022 00:08: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 h1-20020a170902f54100b0016f85feae65sm648114plf.87.2022.08.17.00.08.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 00:08:23 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 0D1231142EA6; Wed, 17 Aug 2022 16:38:21 +0930 (ACST) Date: Wed, 17 Aug 2022 16:38:21 +0930 From: Alan Modra To: binutils@sourceware.org Subject: timeout in mmo_get_symbols Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3036.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, T_SCC_BODY_TEXT_LINE 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-List-Received-Date: Wed, 17 Aug 2022 07:08:26 -0000 Fix mmo_get_byte to return a fail-safe value, not just on the first call with a read error but on subsequent calls too. * mmo.c (mmo_get_byte): Return the fail-safe value on every call after a read error. diff --git a/bfd/mmo.c b/bfd/mmo.c index 30af28c8bdc..80b5cb6b4ca 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -1180,15 +1180,14 @@ mmo_get_byte (bfd *abfd) if (abfd->tdata.mmo_data->byte_no == 0) { - if (! abfd->tdata.mmo_data->have_error + if (!abfd->tdata.mmo_data->have_error && bfd_bread (abfd->tdata.mmo_data->buf, 4, abfd) != 4) - { - abfd->tdata.mmo_data->have_error = true; + abfd->tdata.mmo_data->have_error = true; - /* A value somewhat safe against tripping on some inconsistency - when mopping up after this error. */ - return 128; - } + /* A value somewhat safe against tripping on some inconsistency + when mopping up after this error. */ + if (abfd->tdata.mmo_data->have_error) + return 128; } retval = abfd->tdata.mmo_data->buf[abfd->tdata.mmo_data->byte_no]; -- Alan Modra Australia Development Lab, IBM