Permalink
Browse files

print_tree() printed ENCLOSE_OPTION target twice

There is a bug in Oniguruma 5.9.2 in print_tree() in regcomp.c
causing it to printing the child of ENCLOSE_OPTION node twice:

  PATTERN: /a(?v:b)c/ (ASCII-8BIT)
  <list:965430>
     <string:96af40>a
     <enclose:965570> option:4096
        <quantifier:965520>{0,1}      <=== OK.  Printed once.
           <string:965480>b

        <quantifier:965520>{0,1}      <=== Bug!  Printed twice.
           <string:965480>b
     <quantifier:96c830>{0,-1}?
        <anychar:96ae00>
     <string:96c920>c

This patch fixes the bug.
  • Loading branch information...
1 parent 2eeb278 commit 713c5ffb998baf97806ee0356a73fb98b84ed341 @sunaku committed Nov 12, 2011
Showing with 1 addition and 2 deletions.
  1. +1 −2 regcomp.c
View
@@ -6216,8 +6216,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
fprintf(f, "<enclose:%x> ", (int )node);
switch (NENCLOSE(node)->type) {
case ENCLOSE_OPTION:
- fprintf(f, "option:%d\n", NENCLOSE(node)->option);
- print_indent_tree(f, NENCLOSE(node)->target, indent + add);
+ fprintf(f, "option:%d", NENCLOSE(node)->option);
break;
case ENCLOSE_MEMORY:
fprintf(f, "memory:%d", NENCLOSE(node)->regnum);

0 comments on commit 713c5ff

Please sign in to comment.