develooper Front page | perl.perl5.porters | Postings from April 2001

[PATCH @9846] dumping ANYOF

Thread Next
From:
Hugo
Date:
April 25, 2001 22:30
Subject:
[PATCH @9846] dumping ANYOF
Message ID:
200104260432.FAA12669@crypt.compulink.co.uk
I'm afraid I've not kept up to date with the discussions on this, but
the latest approach (@9846) isn't working: it changes regcomp.c:S_dumpuntil
to use 'node = next', which relies on node->next_off, which isn't set.
This is giving me coredumps:

crypt% ./perl -Dr -we 'warn "match <$&>\n" while "xbx" =~ m{(\G|x)([^x]*)x}g' 2>&1 | more
Compiling REx `(\G|x)([^x]*)x'
size 28 Got 228 bytes for offset annotations.
first at 3
rarest char x at 0
   1: OPEN1(3)
   3:   BRANCH(5)
   4:     GPOS(8)
   5:   BRANCH(8)
   6:     EXACT <x>(8)
   8: CLOSE1(10)
  10: OPEN2(12)
  12:   STAR(24)
  13:     ANYOF[\0-wy-\377{all-unicode}](0)
Segmentation fault (core dumped)
crypt% 

I think that the right solution is to ensure node->next_off is set
correctly for ANYOF nodes, as in the patch below. This fixes the
coredump, so the above test loops as expected (working on that one).

Hugo
--- regcomp.c.old	Sun Apr 22 17:17:39 2001
+++ regcomp.c	Thu Apr 26 05:28:56 2001
@@ -3929,6 +3929,7 @@
 	n = add_data(pRExC_state, 1, "s");
 	RExC_rx->data->data[n] = (void*)rv;
 	ARG_SET(ret, n);
+	NEXT_OFF(ret) = RExC_emit - ret;
     }
 
     return ret;

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About