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)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 019911F44D for ; Thu, 25 Apr 2024 02:52:02 +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=ACUgI8Rg; 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=fY8uz8F8; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id C8D6684484; Thu, 25 Apr 2024 02:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1714013511; bh=fDrx5lbjw68yzr9g5jdtXtZ/Uo/BS4OIACQbywKMtEw=; 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=ACUgI8RgJh4FoE2YPVdXYkdPPiJbjbGhrIC7qxW29CSqToLl9VJ8vk90V1NL05VI5 qI4ishz+Iu6B1nz3j3LVjrsqSWZycDfvfPRuJG680s+v8LjMw9VZO9vs4tv02h4cDk 7BZsc2dTBbncOhCR69naibYeTnZvBg86VsIMQ+d0= Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 783418442C for ; Thu, 25 Apr 2024 02:51:48 +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=fY8uz8F8; 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=Wz7yxAnNFf4NT2cp8fne8WM6SQQ4ljhu4skSG8LiKs4=; b=fY8uz8F8gej6FbPubqs4dZpoEwJ6gxQA1fbt5LCWQfsrBBkm0oFpx93FYGt+pF386JvO Qiepq7zSIZSgFjFMdFFB6a2va6qP+s+GwapnRNNaed0WoUAdm7Ufu9Oh0iD3cmb/8AXWM0 2MnJIb1QDnWttk9XifBJAgj21nZsGVlTFNR7+55Dv688C1fECJWzTUkKnJkPwb8mZKjtHn ZkqoU4o+fjzfQwxqr7J4PV4ihYpYB187GOLk/e7ZKquhFGeuM47IlKO16atM3L+SpsXbtA ooPdVNemSrewJrGElADfLVaGpXvOTPD2flQZK8xGuWeJ2k+yEFQ5qQ1Aqny5kBbg== Received: by recvd-canary-5bf84bf8f7-kx659 with SMTP id recvd-canary-5bf84bf8f7-kx659-1-6629C543-4 2024-04-25 02:51:47.184120381 +0000 UTC m=+1054329.341769108 Received: from herokuapp.com (unknown) by geopod-ismtpd-38 (SG) with ESMTP id 0IpHvlhsSc-VGU77ONKgUg for ; Thu, 25 Apr 2024 02:51:47.148 +0000 (UTC) Date: Thu, 25 Apr 2024 02:51:47 +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: 94294 X-SG-EID: =?us-ascii?Q?u001=2E1emsXUPoHIO6+BhEIvYfmuC7x4ZESpqThSsyF7zTbbBJGe1o9SVatRBz7?= =?us-ascii?Q?DMWuJQH0UcouJY=2FUlS45wJiHX+Pw5++hp7yKAGt?= =?us-ascii?Q?K+bfl6KuhEsX1clGuk93d2BIhBx6syxHwW1fKsQ?= =?us-ascii?Q?Epwc+3syZqZWv5dx46vf6hP459s4aMmL28VXy+S?= =?us-ascii?Q?eJIDzMMuEPeZcHA7pgZ1iTI0gG8HGZghRWRrG5A?= =?us-ascii?Q?njwGNaBpiZl49jxhN3nfh=2FPUX2eIURy7eyHTQaw?= =?us-ascii?Q?TV821DCdNzjJrltDHRgbUXA1gg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: NOWYVCRYSLNDDZZCEYC3G3C56HDAA5OH X-Message-ID-Hash: NOWYVCRYSLNDDZZCEYC3G3C56HDAA5OH 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:117698] [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 updated by dodecadaniel (Daniel Colson). I opened https://github.com/ruby/ruby/pull/10630. I'm still fairly new to all this, so please correct me if I got something wrong! ---------------------------------------- Bug #20453: Pointer being freed was not allocated in Regexp timeout https://bugs.ruby-lang.org/issues/20453#change-108107 * 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/