From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id D44943857C41 for ; Tue, 25 Aug 2020 13:26:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D44943857C41 Received: by mail-pj1-x102e.google.com with SMTP id kx11so799873pjb.5 for ; Tue, 25 Aug 2020 06:26:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=gI7kaLlMKIlIMJzB/qsGZU8lt9xgzAipbb+YB39DbLY=; b=ohNsakeFtHNEQQPMrnZrZFybpSpUVhr6dFZrepRZI3rTQfmn5VjRR7x/Un2Vto5y7s B9U5a0VYt17sGUn4x60TGh19N4tTU1nOQw/ccyWwYIBqWOpSdn2PFl2MSa17W8cWFuSH YqjNQn7FIanzfCKRjoHSHSXObf8Xz5NVlix74gA840Hfp3ZQlHATCEb1PUCjfV5F0vpl bar0wDIMS9BW3Fr2DXhkWdhIP73vZJoJV8tJyx9fzrlyoQbVTRU7CKx15J/eGwoR0BeN clw7FoOrQFvXo8r6b/n+iTzsV/3u6QOyf5eqSscnahiAzWuyUoSYIzEfgH/lK6kDn1Lj m9YQ== X-Gm-Message-State: AOAM530o7NPZL3t0xN8DG+Ef5nnKWAUT9bagnHlS+FqHf9f0+E+zz9G9 fG8PDt3RYGpC3QMajTv7dLhpQWcthYZOCQ== X-Google-Smtp-Source: ABdhPJwOBAgVdgRbdAHb0ACs8gtpIW7xFw6nbzaneaF6ekp5GuWEKoVxvemeJC4+pEOGpzOPw2YO0g== X-Received: by 2002:a17:90b:194d:: with SMTP id nk13mr1667598pjb.92.1598361979438; Tue, 25 Aug 2020 06:26:19 -0700 (PDT) Received: from bubble.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id d80sm15688599pfd.22.2020.08.25.06.26.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 06:26:18 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 4B8AE81506; Tue, 25 Aug 2020 22:56:15 +0930 (ACST) Date: Tue, 25 Aug 2020 22:56:15 +0930 From: Alan Modra To: binutils@sourceware.org Subject: PR26419, ASAN: mn10300_elf_relax_section elf-m10300.c:3943 Message-ID: <20200825132614.GS15695@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Tue, 25 Aug 2020 13:26:22 -0000 PR 26419 * elf-m10300.c (mn10300_elf_relax_section): Don't attempt access before start of section. diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index ae8cac84e6..7c63ce4cd1 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -3932,7 +3932,7 @@ mn10300_elf_relax_section (bfd *abfd, /* See if the value will fit in 24 bits. We allow any 16bit match here. We prune those we can't handle below. */ - if ((long) value < 0x7fffff && (long) value > -0x800000) + if (value + 0x800000 < 0x1000000 && irel->r_offset >= 3) { unsigned char code; @@ -4003,7 +4003,7 @@ mn10300_elf_relax_section (bfd *abfd, /* See if the value will fit in 16 bits. We allow any 16bit match here. We prune those we can't handle below. */ - if ((long) value < 0x7fff && (long) value > -0x8000) + if (value + 0x8000 < 0x10000 && irel->r_offset >= 2) { unsigned char code; -- Alan Modra Australia Development Lab, IBM