From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 30E443857C4A; Wed, 17 Aug 2022 07:08:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30E443857C4A Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] timeout in mmo_get_symbols X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 7a1bc25b9d2c3f066000d07b5254d20367b6da0f X-Git-Newrev: 31e43bfffbc585a59d07f21f191317a714476e38 Message-Id: <20220817070857.30E443857C4A@sourceware.org> Date: Wed, 17 Aug 2022 07:08:57 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2022 07:08:57 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D31e43bfffbc5= 85a59d07f21f191317a714476e38 commit 31e43bfffbc585a59d07f21f191317a714476e38 Author: Alan Modra Date: Wed Aug 17 16:12:26 2022 +0930 timeout in mmo_get_symbols =20 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. =20 * mmo.c (mmo_get_byte): Return the fail-safe value on every call after a read error. Diff: --- bfd/mmo.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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) =20 if (abfd->tdata.mmo_data->byte_no =3D=3D 0) { - if (! abfd->tdata.mmo_data->have_error + if (!abfd->tdata.mmo_data->have_error && bfd_bread (abfd->tdata.mmo_data->buf, 4, abfd) !=3D 4) - { - abfd->tdata.mmo_data->have_error =3D true; + abfd->tdata.mmo_data->have_error =3D true; =20 - /* 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; } =20 retval =3D abfd->tdata.mmo_data->buf[abfd->tdata.mmo_data->byte_no];