From patchwork Tue Jun 27 05:16:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 21273 Received: (qmail 126415 invoked by alias); 27 Jun 2017 05:17:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 125830 invoked by uid 89); 27 Jun 2017 05:16:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=regret, unfortunate, dear X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pf0-f182.google.com Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Jun 2017 05:16:38 +0000 Received: by mail-pf0-f182.google.com with SMTP id q86so10697495pfl.3; Mon, 26 Jun 2017 22:16:32 -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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0ExrAMz6Q1elpGkFuH5Uz+RaG46tUOiNyOJzHbFxK0M=; b=fw/aTdi/1LSpZjmUJ6SmbutiqDYkfKy7hYum3Mn8wNAj154PGE4JlX0lVi10nEuiuY QPWrdo4dn1skWfTmmswrrZX3myyPX+M0tTaYD9m4j6lhLT3WknWXBZ4QnvQZbGxLkOXu Alu3JSKPIgE2+6f9zNjx098oZT+IYE4CKHS0Y98TFlodpFiidSESmpp4RSjrMPtUxnpE I9jUyl9JaVI3sfMtmeqfI1zthfY92NA98Ucdt4SqhOSoRjXMOaVdzhkS+l4MwytCgjX+ wCB+q/45odqT0zFLVVttxMptHpcvhZv9ynz55fqZUvcO/8wE8OqK9lXpOibI+nrwaMU+ Ke4Q== X-Gm-Message-State: AKS2vOwCEavmuNP7XQ1/Neuo1YpZuJ4dDGa5VLnjXXX4WfTHIfwyKR4R Dk1mcYS/0RAi7CET X-Received: by 10.101.70.137 with SMTP id h9mr3601538pgr.50.1498540591423; Mon, 26 Jun 2017 22:16:31 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-71-80.tyqh2.lon.bigpond.net.au. [58.160.71.80]) by smtp.gmail.com with ESMTPSA id t128sm3026966pfd.64.2017.06.26.22.16.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jun 2017 22:16:30 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id B46B2C107D; Tue, 27 Jun 2017 14:46:26 +0930 (ACST) Date: Tue, 27 Jun 2017 14:46:26 +0930 From: Alan Modra To: gdb-patches@sourceware.org, binutils@sourceware.org Subject: Re: Oh dear. I regret to inform you that commit 'More fixes for bfd_get_section_contents change' might be unfortunate Message-ID: <20170627051626.GE3275@bubble.grove.modra.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) On Mon, Jun 26, 2017 at 11:34:50PM -0400, gdb-buildbot@sergiodj.net wrote: > ../../binutils-gdb/bfd/libbfd.c:818:44: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] > || section->filepos + offset + count > filesz) The types are file_ptr, file_ptr, bfd_size_type, unsigned file_ptr. file_ptr is signed, bfd_size_type unsigned. The target is 32-bit, so I guess the host is too, making bfd_size_type 32 bits. It must be that file_ptr on the host is 64-bit, which is the only way I see the left hand expression being signed. PR binutils/21665 * libbfd.c (_bfd_generic_get_section_contents): Warning fix. (_bfd_generic_get_section_contents_in_window): Likewise. diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 0776451..0d9de2b 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -815,7 +815,7 @@ _bfd_generic_get_section_contents (bfd *abfd, filesz = bfd_get_file_size (abfd); if (offset + count < count || offset + count > sz - || section->filepos + offset + count > filesz) + || (ufile_ptr) section->filepos + offset + count > filesz) { bfd_set_error (bfd_error_invalid_operation); return FALSE; @@ -873,7 +873,7 @@ _bfd_generic_get_section_contents_in_window sz = section->size; filesz = bfd_get_file_size (abfd); if (offset + count > sz - || section->filepos + offset + count > filesz + || (ufile_ptr) section->filepos + offset + count > filesz || ! bfd_get_file_window (abfd, section->filepos + offset, count, w, TRUE)) return FALSE;