[#42243] コミュニティと宗教の分離について — Beyond <beyond@...>

14 messages 2006/05/21

[#42267] メニューのループについて — リックス <rubyer4649@...>

りっくすです

21 messages 2006/05/27

[#42301] Re: メニューのループについて — "conundrum /" <conundrum@...>

conundrumです。

11 messages 2006/05/28

[ruby-list:42237] Re: 強欲な正規表現のマッチングで core を吐く

From: "K.Kosako" <sndgk393@...>
Date: 2006-05-20 17:03:10 UTC
List: ruby-list #42237
NARUSE, Yui wrote:
> ところで、3のバックトラックを抑制する方法ですが、
> nested_parentheses =
>   /(?<pare>   \( ([^\(\)]++ | \g<pare>)*+ \)  )/x
> nested_parentheses =~ "((a))"
> のように *+ とすると core を吐きます。

バグです。
Ruby 1.9でのパッチです。
--
小迫

--- regexec.c.orig	2006-05-10 23:34:23.362696000 +0900
+++ regexec.c	2006-05-21 01:55:17.318676800 +0900
@@ -360,7 +360,8 @@ typedef struct _StackType {
 /* stack type check mask */
 #define STK_MASK_POP_USED     0x00ff
 #define IS_TO_VOID_TARGET(stk) \
-     (((stk)->type & STK_MASK_POP_USED) || (stk)->type ==
STK_NULL_CHECK_START)
+     (((stk)->type & STK_MASK_POP_USED) || \
+       (stk)->type == STK_NULL_CHECK_START || (stk)->type ==
STK_NULL_CHECK_END)

 typedef struct {
   void* stack_p;



In This Thread