From patchwork Thu Jan 7 01:14:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bruno Haible X-Patchwork-Id: 41662 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61A833951471; Thu, 7 Jan 2021 01:14:24 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.53]) by sourceware.org (Postfix) with ESMTPS id EA4B23846033 for ; Thu, 7 Jan 2021 01:14:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EA4B23846033 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=clisp.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=bruno@clisp.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1609982061; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:From: Subject:Sender; bh=kSxedOn1KJAki9h4WW60wl+EEQ5251cMzIMC+JJJspM=; b=HP5MNKQVdr6l1APzz9WjzgaGg9A+2w6fC/ZV4M+zCTcznDMm/0jV1OiUCtatL4DRBd BQ53KnRbTianFPDiyZWhcq+qQ4cdXWSR2Hv1ML3YHRCYXc+CXkj4oiRdMRqu+AwHuWe0 bzup7yfkV8MgGtLUv3rKIB1L0XAVdZWww5ayOYdAqpB9ZdCmpFbOdOhqAW3YGL6oPoy3 L7C8OUAbMB88w05Y2U5L4V4RdfdMTgrHj2OdaVN1w2gX2VZ1ECGtO5wBoQ37of1ySbr3 0F1DnIVOusvdxTHPC5xXV2N0URHCyH6r0J1jzGnsRqZPjtji0iBOun+quhhiquYlPx6H 0fAg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOHqf3yZdW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 47.12.1 DYNA|AUTH) with ESMTPSA id u0aa20x071ED325 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Thu, 7 Jan 2021 02:14:13 +0100 (CET) From: Bruno Haible To: libc-alpha@sourceware.org Subject: [PATCH 1/5] argp: fix pointer-subtraction bug Date: Thu, 07 Jan 2021 02:14:12 +0100 Message-ID: <1745404.52eaX7kXFs@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <1609981580-17229-1-git-send-email-bruno@clisp.org> References: <1609981580-17229-1-git-send-email-bruno@clisp.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" This patch is attached. (git send-email did not send it because it is authored by Paul, not me.) From 5a404daee6857506202b5a5eed331aba760b2308 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 7 Jan 2021 00:51:33 +0100 Subject: [PATCH 1/5] argp: fix pointer-subtraction bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * argp/argp-help.c (hol_append): Don’t subtract pointers to different arrays, as this can run afoul of -fcheck-pointer-bounds. See the thread containing Bruno Haible’s report in: http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00171.html --- argp/argp-help.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/argp/argp-help.c b/argp/argp-help.c index 15c5fd2..f417e12 100644 --- a/argp/argp-help.c +++ b/argp/argp-help.c @@ -867,7 +867,8 @@ hol_append (struct hol *hol, struct hol *more) /* Fix up the short options pointers from HOL. */ for (e = entries, left = hol->num_entries; left > 0; e++, left--) - e->short_options += (short_options - hol->short_options); + e->short_options + = short_options + (e->short_options - hol->short_options); /* Now add the short options from MORE, fixing up its entries too. */ -- 2.7.4