From 5ea9f6b0f157886aca20fcd9e444abfddccd840f Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Sat, 21 Jul 2018 14:52:26 +0000 Subject: [PATCH] Some places where the new opcode OP_COMMIT_ARG needs to be handled and which I forgot. --- src/pcre2_find_bracket.c | 3 ++- src/pcre2_pattern_info.c | 3 ++- src/pcre2_printint.c | 3 ++- src/pcre2_study.c | 4 +++- testdata/testinput2 | 2 ++ testdata/testoutput2 | 8 ++++++++ 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/pcre2_find_bracket.c b/src/pcre2_find_bracket.c index 357385a..38cd830 100644 --- a/src/pcre2_find_bracket.c +++ b/src/pcre2_find_bracket.c @@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016 University of Cambridge + New API code Copyright (c) 2016-2018 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -131,6 +131,7 @@ for (;;) break; case OP_MARK: + case OP_COMMIT_ARG: case OP_PRUNE_ARG: case OP_SKIP_ARG: case OP_THEN_ARG: diff --git a/src/pcre2_pattern_info.c b/src/pcre2_pattern_info.c index 906e919..88bef4e 100644 --- a/src/pcre2_pattern_info.c +++ b/src/pcre2_pattern_info.c @@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016-2017 University of Cambridge + New API code Copyright (c) 2016-2018 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -390,6 +390,7 @@ while (TRUE) #endif case OP_MARK: + case OP_COMMIT_ARG: case OP_PRUNE_ARG: case OP_SKIP_ARG: case OP_THEN_ARG: diff --git a/src/pcre2_printint.c b/src/pcre2_printint.c index e4dd53f..5d595a1 100644 --- a/src/pcre2_printint.c +++ b/src/pcre2_printint.c @@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016-2017 University of Cambridge + New API code Copyright (c) 2016-2018 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -799,6 +799,7 @@ for(;;) break; case OP_MARK: + case OP_COMMIT_ARG: case OP_PRUNE_ARG: case OP_SKIP_ARG: case OP_THEN_ARG: diff --git a/src/pcre2_study.c b/src/pcre2_study.c index 087012d..d5c6270 100644 --- a/src/pcre2_study.c +++ b/src/pcre2_study.c @@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016-2017 University of Cambridge + New API code Copyright (c) 2016-2018 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -707,6 +707,7 @@ for (;;) /* Skip these, but we need to add in the name length. */ case OP_MARK: + case OP_COMMIT_ARG: case OP_PRUNE_ARG: case OP_SKIP_ARG: case OP_THEN_ARG: @@ -956,6 +957,7 @@ do case OP_CIRCM: case OP_CLOSE: case OP_COMMIT: + case OP_COMMIT_ARG: case OP_COND: case OP_CREF: case OP_FALSE: diff --git a/testdata/testinput2 b/testdata/testinput2 index 5be6cf1..766f8db 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -2949,6 +2949,8 @@ /abc(*:)pqr/ +/(*COMMIT:X)/B + # This should, and does, fail. In Perl, it does not, which I think is a # bug because replacing the B in the pattern by (B|D) does make it fail. # Turning off Perl's optimization by inserting (??{""}) also makes it fail. diff --git a/testdata/testoutput2 b/testdata/testoutput2 index 2a1f284..a041ccf 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -10154,6 +10154,14 @@ Failed: error 166 at offset 10: (*MARK) must have an argument /abc(*:)pqr/ Failed: error 166 at offset 6: (*MARK) must have an argument +/(*COMMIT:X)/B +------------------------------------------------------------------ + Bra + *COMMIT X + Ket + End +------------------------------------------------------------------ + # This should, and does, fail. In Perl, it does not, which I think is a # bug because replacing the B in the pattern by (B|D) does make it fail. # Turning off Perl's optimization by inserting (??{""}) also makes it fail.