Message ID | 20240801151738.400796-30-poulhies@adacore.com |
---|---|
State | New |
Headers | show
Return-Path: <gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=VkeqYb3Y; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZY6P2GyZz1ybX for <incoming@patchwork.ozlabs.org>; Fri, 2 Aug 2024 01:39:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 828163851C30 for <incoming@patchwork.ozlabs.org>; Thu, 1 Aug 2024 15:39:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 8F9CD385DDFE for <gcc-patches@gcc.gnu.org>; Thu, 1 Aug 2024 15:18:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F9CD385DDFE Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8F9CD385DDFE Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525534; cv=none; b=PnSm1Sa2CWu90YU/Gcr32Ksl6E7rLlbrzRpSpGVyp0IPVhFYsKnKP1RBh+6E3O4wpjrtpGwkU3cSJjNRhYumdN7UQxqTtHjZNruEjyvJww+wEUkhzc+qnw+J6GLBkGzoPBRsoS/gPIptzxOKr/KD0JdJstOTIl+0WvrqdFiUOtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525534; c=relaxed/simple; bh=3fOqU8vDgz/nBiKUiV1xHCja2KU3o4dM2VvCP4FX/0o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OWA8oGZbkDQ6Bkw4/oUxFag1CKrBZ066v2TDkeGxM/Vt70dY2Cw5/RlUayAZE41nhQ+skQyY6tmV8nA1wiZTSW6NPxgdiHJSfzR74DA3HlxUoHOqTauRemqLRTU/v1Pq9XnTBjqLoyszQokSyeFKzV3xjM/DHyiuFGk+x1p551o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4266f3e0df8so45275195e9.2 for <gcc-patches@gcc.gnu.org>; Thu, 01 Aug 2024 08:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1722525515; x=1723130315; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YKbO3S0sRMxFfKCQJQwQi15zyUgy9t8WUqI4e3bOln4=; b=VkeqYb3Y5SsjRg7OETiWlhqTJ/T48l17qrgMyryHK0G4Cy5JzgEJcjCQnsyTGP2KSW vqmrJZ1y8VCy8WdbsG4uZW/Qu2c0CxoWOp7gCtomkKZzIZarjUOjM2r9fOzzwTyTewy2 hFKd6YXLX4sIn4zjyTlpHx7oSzM0n5hKwP/3RcxzODfz8qiODdFEvdq1edQJon4HhgZK uXfEzPm48JCezQ40S29AnrEM2OKtxUrQ+Ho6kInHn5GlptHVmikPONS4ZHNJYp7LIrJV tl0awsvE5TteONj8m0uCC87zvHXZc6gg3BvNdbNfBL9pLUpSCvn/RruBkbkwjHZfDc4r ktAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722525515; x=1723130315; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YKbO3S0sRMxFfKCQJQwQi15zyUgy9t8WUqI4e3bOln4=; b=KdMH48PmNV66AkMSZXiHNv1nfgleWhjoHZAcCxAyiAsLYZ/pW7+R0X/RtRPVDGtVFx Skz6tCEOoAn1Yjm1ig43wLqTbsunxbkW8jEqPd3vSaRwAlyTCOFDy4t53vfUFreqDuZS g99s+lhVwOXdmztflLNgr2L8MbnhW41UMwtmMINipVXDFiu3R4L2c7BG+Nzdmk53pVtl Eaydzrf9X5sibiYsezDvej3WGrgATcvumMGj6IiWkolNJTEbNvBef2Pd4Z1DpGIrDYhF 3dL8uFvcFzU4EFEgZNQFRXgVZH4acWAe684tqEQQ7zrnoI/aeqcVE3dILTg0lPAsGnTN LnEw== X-Gm-Message-State: AOJu0YywNRv0fIgd5Orh8gW2683dCIpgsY//v4SUhs/bg0Fez3dzRQ7h au2VnYC3m4BNb7/nf28H4GToodb3CXIgYYMrZ6LH1MF4u1shf90cRKMzmVdIPsXyaoiYXg0TbF7 3og== X-Google-Smtp-Source: AGHT+IGV3/oc63KA8b2rmmWz7Z5EOc7Y9QczNITrvAsxj+su8KlWz1DorWxTsjd1mKkORpSkJgYvVw== X-Received: by 2002:a5d:424a:0:b0:366:e89c:342e with SMTP id ffacd0b85a97d-36bbc1c0c76mr104903f8f.53.1722525515192; Thu, 01 Aug 2024 08:18:35 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:b6aa:4751:9ea1:da1e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36857fdesm20065995f8f.75.2024.08.01.08.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 08:18:34 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Yannick Moy <moy@adacore.com> Subject: [COMMITTED 30/30] ada: Fix computation of new size when reallocating unbounded string Date: Thu, 1 Aug 2024 17:17:38 +0200 Message-ID: <20240801151738.400796-30-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801151738.400796-1-poulhies@adacore.com> References: <20240801151738.400796-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org |
Series |
[COMMITTED,01/30] ada: Remove obsolete workaround
|
expand
|
diff --git a/gcc/ada/libgnat/a-strunb.adb b/gcc/ada/libgnat/a-strunb.adb index 219abad3f07..c3d4c71271b 100644 --- a/gcc/ada/libgnat/a-strunb.adb +++ b/gcc/ada/libgnat/a-strunb.adb @@ -824,7 +824,7 @@ package body Ada.Strings.Unbounded is declare New_Size : constant Positive := Saturated_Sum - (Sum (S_Length, Chunk_Size), S_Length / Growth_Factor); + (Sum (Source.Last, Chunk_Size), S_Length / Growth_Factor); New_Rounded_Up_Size : constant Positive := Saturated_Mul
From: Yannick Moy <moy@adacore.com> The procedure Realloc_For_Chunk which is used to reallocate an unbounded string when needed may lead in theory to an overflow, due to the use of variable S_Length denoting the current allocated length instead of Source.Last denoting the current string length. Now fixed. This has no effect in practice since the only targets that use this version of Ada.Strings.Unbounded do not have enough memory to make it possible to have an overflow here. gcc/ada/ * libgnat/a-strunb.adb (Realloc_For_Chunk): Fix computation of new size. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-strunb.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)