From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 8C6FB1F44D for ; Thu, 25 Apr 2024 02:19:22 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=OPV3mAmi; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=FnS565Q1; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 567618447B; Thu, 25 Apr 2024 02:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1714011554; bh=Tp11jkv+QfW4hgFhk+FFBLANXN+iVsWLiM9bjOr7cvY=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=OPV3mAmi+WqtocWQ6SJGh+CSuzmkHL4VywGo4b0CouP2/VGzUfiZxsWAt2P0j8Ve/ LGdtkpBk1N0BniwjirmaInWMOqE4Yq54kKWn+mdU4Co/BHsfSU4EGEtuert2wR1dlE vT9yfJkFhhtQRV5xMnGMFKIQjn0cM+9DrkHl7DGA= Received: from s.wrqvtvvn.outbound-mail.sendgrid.net (s.wrqvtvvn.outbound-mail.sendgrid.net [149.72.120.130]) by nue.mailmanlists.eu (Postfix) with ESMTPS id CB77084450 for ; Thu, 25 Apr 2024 02:19:10 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=FnS565Q1; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=umrL3d8U9OfFBfdXHq49JAOIlHpEqqf02gu84E+uvyU=; b=FnS565Q1h0RrHeN0U0RAJ96fhLTChReozdct3+Ut77oCoInBxktefTu4o+5dOQU6OsBc hPapSfTE0ziEtJbyOdaDU7JlVTjCAJbYHc39WEVXwXlTJm1Xc5czCFY1E3Toc0dI5AULmP 9xhxuO7N6AJIIaGdGyFJ8YEaJKaoyW36sVYUXKIy5daX6U1+leQ6cZsqqWlNyVlwstRd0Z +frzom4VfOzjjohZ05l7KXCTec/Gjd25xs/+gcU1tUugC63csPL2KB/9zVjaIvGc519Hqs cVubgAq2PgfI1Cwucp74+bqPqxBk8YOx+eDlg2jBXvxA4nAkVMoYrReGhcxN6uiw== Received: by recvd-bb7996b79-56n2b with SMTP id recvd-bb7996b79-56n2b-1-6629BD9D-7 2024-04-25 02:19:09.767083108 +0000 UTC m=+1052269.288610639 Received: from herokuapp.com (unknown) by geopod-ismtpd-36 (SG) with ESMTP id n4OAty03TxmzVdUICrLXyg for ; Thu, 25 Apr 2024 02:19:09.686 +0000 (UTC) Date: Thu, 25 Apr 2024 02:19:09 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20453 X-Redmine-Issue-Author: dodecadaniel X-Redmine-Issue-Priority: Normal X-Redmine-Sender: dodecadaniel X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 94293 X-SG-EID: =?us-ascii?Q?u001=2E1emsXUPoHIO6+BhEIvYfmuC7x4ZESpqThSsyF7zTbbBJGe1o9SVatRBz7?= =?us-ascii?Q?DMWuJQH0UcouJY=2FUlS45wJiHX+Pw5++hp7yKAGt?= =?us-ascii?Q?K+bfl6KuhEsfKTjNXEnt424mgQgK4zDkpCTh2GU?= =?us-ascii?Q?FsYG85gxYSpukDoiHJV0Uo5bAp=2FiOf13vkvZ1ZH?= =?us-ascii?Q?UZBH7kzERtpUqhaMoLNgdPpO2NpqRl7=2Fbl2kxhW?= =?us-ascii?Q?LUYbqByrU7F=2FezAyTIWaLZcz6kVPmrWaczeJvEe?= =?us-ascii?Q?mtBUw3wojYGG+TsVJRlXxiYqag=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: QNLO2EXQABAWNYNVITSQYLGSAI2PWJYY X-Message-ID-Hash: QNLO2EXQABAWNYNVITSQYLGSAI2PWJYY X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:117697] [Ruby master Bug#20453] Pointer being freed was not allocated in Regexp timeout List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "dodecadaniel (Daniel Colson) via ruby-core" Cc: "dodecadaniel (Daniel Colson)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20453 has been reported by dodecadaniel (Daniel Colson). ---------------------------------------- Bug #20453: Pointer being freed was not allocated in Regexp timeout https://bugs.ruby-lang.org/issues/20453 * Author: dodecadaniel (Daniel Colson) * Status: Open * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- https://bugs.ruby-lang.org/issues/20228 frees `stk_base` to avoid a memory leak, but `stk_base` is sometimes stack allocated ([see `xalloca`](https://github.com/ruby/ruby/blob/dde99215f2bc60c22a00fc941ff7f714f011e920/regexec.c#L1177-L1181)). So the free only works if the regex stack grows enough that it needs to double ([see `xmalloc` and `xrealloc` in `stack_double`](https://github.com/ruby/ruby/blob/dde99215f2bc60c22a00fc941ff7f714f011e920/regexec.c#L1210-L1249). Reproduction: ```ruby Regexp.timeout = 0.001 /^(a*)x$/ =~ "a" * 1000000 + "x"' ``` I'll open a PR shortly. https://bugs.ruby-lang.org/issues/20228 was backported to 3.3.1, so this bug affects that version as well. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/