Skip to content

Commit ae5beff

Browse files
authored
Upgrade bundled pcre2lib to 10.43 (php#13413)
1 parent 0941507 commit ae5beff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+22877
-11490
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ PHP NEWS
8484
- Output:
8585
. Clear output handler status flags during handler initialization. (haszi)
8686

87+
- PCRE:
88+
. Upgrade bundled pcre2lib to version 10.43. (nielsdos)
89+
8790
- PDO:
8891
. Fixed setAttribute and getAttribute. (SakiTakamachi)
8992
. Implemented PDO driver-specific subclasses RFC. (danack, kocsismate)

UPGRADING

+13
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ PHP 8.4 UPGRADE NOTES
6464
exclusively, without also specifying a JIT mode using opcache.jit. To enable
6565
JIT, set the opcache.jit config value accordingly.
6666

67+
- PCRE:
68+
. The bundled pcre2lib has been updated to version 10.43.
69+
As a consequence, this means {,3} is now recognized as a quantifier instead
70+
of as text. Furthermore, the meaning of some character classes in UCP mode
71+
has changed. Consult https://github.com/PCRE2Project/pcre2/blob/master/NEWS
72+
for a full changelog.
73+
6774
- PDO_DBLIB:
6875
. setAttribute, DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER and DBLIB_ATTR_DATETIME_CONVERT
6976
have been changed to set value as a bool.
@@ -179,6 +186,12 @@ PHP 8.4 UPGRADE NOTES
179186
- Phar:
180187
. Added support for the unix timestamp extension for zip archives.
181188

189+
- PCRE:
190+
. The bundled pcre2lib has been updated to version 10.43.
191+
As a consequence, LoongArch JIT support has been added, spaces
192+
are now allowed between braces in Perl-compatible items, and
193+
variable-length lookbehind assertions are now supported.
194+
182195
- PDO:
183196
. Added support for driver-specific subclasses.
184197
RFC: https://wiki.php.net/rfc/pdo_driver_specific_subclasses

ext/pcre/config.w32

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
EXTENSION("pcre", "php_pcre.c", false /* never shared */,
44
"-Iext/pcre/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
5-
ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_compile.c pcre2_config.c pcre2_context.c pcre2_dfa_match.c pcre2_error.c pcre2_jit_compile.c pcre2_maketables.c pcre2_match.c pcre2_match_data.c pcre2_newline.c pcre2_ord2utf.c pcre2_pattern_info.c pcre2_serialize.c pcre2_string_utils.c pcre2_study.c pcre2_substitute.c pcre2_substring.c pcre2_tables.c pcre2_ucd.c pcre2_valid_utf.c pcre2_xclass.c pcre2_find_bracket.c pcre2_convert.c pcre2_extuni.c pcre2_script_run.c", "pcre");
5+
ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_compile.c pcre2_config.c pcre2_context.c pcre2_chkdint.c pcre2_dfa_match.c pcre2_error.c pcre2_jit_compile.c pcre2_maketables.c pcre2_match.c pcre2_match_data.c pcre2_newline.c pcre2_ord2utf.c pcre2_pattern_info.c pcre2_serialize.c pcre2_string_utils.c pcre2_study.c pcre2_substitute.c pcre2_substring.c pcre2_tables.c pcre2_ucd.c pcre2_valid_utf.c pcre2_xclass.c pcre2_find_bracket.c pcre2_convert.c pcre2_extuni.c pcre2_script_run.c", "pcre");
66
ADD_DEF_FILE("ext\\pcre\\php_pcre.def");
77

88
AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Using bundled PCRE library');

ext/pcre/config0.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ else
6060
AC_MSG_CHECKING([for PCRE library to use])
6161
AC_MSG_RESULT([bundled])
6262
pcrelib_sources="pcre2lib/pcre2_auto_possess.c pcre2lib/pcre2_chartables.c pcre2lib/pcre2_compile.c \
63-
pcre2lib/pcre2_config.c pcre2lib/pcre2_context.c pcre2lib/pcre2_dfa_match.c pcre2lib/pcre2_error.c \
63+
pcre2lib/pcre2_config.c pcre2lib/pcre2_context.c pcre2lib/pcre2_chkdint.c pcre2lib/pcre2_dfa_match.c pcre2lib/pcre2_error.c \
6464
pcre2lib/pcre2_jit_compile.c pcre2lib/pcre2_maketables.c pcre2lib/pcre2_match.c pcre2lib/pcre2_match_data.c \
6565
pcre2lib/pcre2_newline.c pcre2lib/pcre2_ord2utf.c pcre2lib/pcre2_pattern_info.c pcre2lib/pcre2_serialize.c \
6666
pcre2lib/pcre2_string_utils.c pcre2lib/pcre2_study.c pcre2lib/pcre2_substitute.c pcre2lib/pcre2_substring.c \

ext/pcre/pcre2lib/config.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
/* Define to any value to enable support for Just-In-Time compiling. */
2828
#ifdef HAVE_PCRE_JIT_SUPPORT
29-
#define SUPPORT_JIT
29+
#define SUPPORT_JIT 1
3030
#endif
3131

3232
/* This limits the amount of memory that pcre2_match() may use while matching
@@ -98,3 +98,13 @@
9898
#define LINK_SIZE 2
9999
#endif
100100

101+
/* The value of MAX_VARLOOKBEHIND specifies the default maximum length, in
102+
characters, for a variable-length lookbehind assertion. */
103+
#ifndef MAX_VARLOOKBEHIND
104+
#define MAX_VARLOOKBEHIND 255
105+
#endif
106+
107+
/* to make a symbol visible */
108+
#ifndef PCRE2_EXPORT
109+
#define PCRE2_EXPORT
110+
#endif

ext/pcre/pcre2lib/pcre2.h

+52-38
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* This is the public header file for the PCRE library, second API, to be
66
#included by applications that call PCRE2 functions.
77
8-
Copyright (c) 2016-2021 University of Cambridge
8+
Copyright (c) 2016-2024 University of Cambridge
99
1010
-----------------------------------------------------------------------------
1111
Redistribution and use in source and binary forms, with or without
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
4242
/* The current PCRE version information. */
4343

4444
#define PCRE2_MAJOR 10
45-
#define PCRE2_MINOR 42
45+
#define PCRE2_MINOR 43
4646
#define PCRE2_PRERELEASE
47-
#define PCRE2_DATE 2022-12-12
47+
#define PCRE2_DATE 2024-02-16
4848

4949
/* When an application links to a PCRE DLL in Windows, the symbols that are
5050
imported have to be identified as such. When building PCRE2, the appropriate
@@ -153,6 +153,12 @@ D is inspected during pcre2_dfa_match() execution
153153
#define PCRE2_EXTRA_ESCAPED_CR_IS_LF 0x00000010u /* C */
154154
#define PCRE2_EXTRA_ALT_BSUX 0x00000020u /* C */
155155
#define PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK 0x00000040u /* C */
156+
#define PCRE2_EXTRA_CASELESS_RESTRICT 0x00000080u /* C */
157+
#define PCRE2_EXTRA_ASCII_BSD 0x00000100u /* C */
158+
#define PCRE2_EXTRA_ASCII_BSS 0x00000200u /* C */
159+
#define PCRE2_EXTRA_ASCII_BSW 0x00000400u /* C */
160+
#define PCRE2_EXTRA_ASCII_POSIX 0x00000800u /* C */
161+
#define PCRE2_EXTRA_ASCII_DIGIT 0x00001000u /* C */
156162

157163
/* These are for pcre2_jit_compile(). */
158164

@@ -180,11 +186,12 @@ pcre2_jit_match() ignores the latter since it bypasses all sanity checks). */
180186
#define PCRE2_SUBSTITUTE_UNSET_EMPTY 0x00000400u /* pcre2_substitute() only */
181187
#define PCRE2_SUBSTITUTE_UNKNOWN_UNSET 0x00000800u /* pcre2_substitute() only */
182188
#define PCRE2_SUBSTITUTE_OVERFLOW_LENGTH 0x00001000u /* pcre2_substitute() only */
183-
#define PCRE2_NO_JIT 0x00002000u /* Not for pcre2_dfa_match() */
189+
#define PCRE2_NO_JIT 0x00002000u /* not for pcre2_dfa_match() */
184190
#define PCRE2_COPY_MATCHED_SUBJECT 0x00004000u
185191
#define PCRE2_SUBSTITUTE_LITERAL 0x00008000u /* pcre2_substitute() only */
186192
#define PCRE2_SUBSTITUTE_MATCHED 0x00010000u /* pcre2_substitute() only */
187193
#define PCRE2_SUBSTITUTE_REPLACEMENT_ONLY 0x00020000u /* pcre2_substitute() only */
194+
#define PCRE2_DISABLE_RECURSELOOP_CHECK 0x00040000u /* not for pcre2_dfa_match() or pcre2_jit_match() */
188195

189196
/* Options for pcre2_pattern_convert(). */
190197

@@ -399,6 +406,7 @@ released, the numbers must not be changed. */
399406
#define PCRE2_ERROR_CONVERT_SYNTAX (-64)
400407
#define PCRE2_ERROR_INTERNAL_DUPMATCH (-65)
401408
#define PCRE2_ERROR_DFA_UINVALID_UTF (-66)
409+
#define PCRE2_ERROR_INVALIDOFFSET (-67)
402410

403411

404412
/* Request types for pcre2_pattern_info() */
@@ -572,19 +580,19 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION pcre2_config(uint32_t, void *);
572580
/* Functions for manipulating contexts. */
573581

574582
#define PCRE2_GENERAL_CONTEXT_FUNCTIONS \
575-
PCRE2_EXP_DECL pcre2_general_context PCRE2_CALL_CONVENTION \
576-
*pcre2_general_context_copy(pcre2_general_context *); \
577-
PCRE2_EXP_DECL pcre2_general_context PCRE2_CALL_CONVENTION \
578-
*pcre2_general_context_create(void *(*)(PCRE2_SIZE, void *), \
583+
PCRE2_EXP_DECL pcre2_general_context *PCRE2_CALL_CONVENTION \
584+
pcre2_general_context_copy(pcre2_general_context *); \
585+
PCRE2_EXP_DECL pcre2_general_context *PCRE2_CALL_CONVENTION \
586+
pcre2_general_context_create(void *(*)(size_t, void *), \
579587
void (*)(void *, void *), void *); \
580588
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
581589
pcre2_general_context_free(pcre2_general_context *);
582590

583591
#define PCRE2_COMPILE_CONTEXT_FUNCTIONS \
584-
PCRE2_EXP_DECL pcre2_compile_context PCRE2_CALL_CONVENTION \
585-
*pcre2_compile_context_copy(pcre2_compile_context *); \
586-
PCRE2_EXP_DECL pcre2_compile_context PCRE2_CALL_CONVENTION \
587-
*pcre2_compile_context_create(pcre2_general_context *);\
592+
PCRE2_EXP_DECL pcre2_compile_context *PCRE2_CALL_CONVENTION \
593+
pcre2_compile_context_copy(pcre2_compile_context *); \
594+
PCRE2_EXP_DECL pcre2_compile_context *PCRE2_CALL_CONVENTION \
595+
pcre2_compile_context_create(pcre2_general_context *);\
588596
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
589597
pcre2_compile_context_free(pcre2_compile_context *); \
590598
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
@@ -595,6 +603,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
595603
pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \
596604
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
597605
pcre2_set_max_pattern_length(pcre2_compile_context *, PCRE2_SIZE); \
606+
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
607+
pcre2_set_max_varlookbehind(pcre2_compile_context *, uint32_t); \
598608
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
599609
pcre2_set_newline(pcre2_compile_context *, uint32_t); \
600610
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
@@ -604,10 +614,10 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
604614
int (*)(uint32_t, void *), void *);
605615

606616
#define PCRE2_MATCH_CONTEXT_FUNCTIONS \
607-
PCRE2_EXP_DECL pcre2_match_context PCRE2_CALL_CONVENTION \
608-
*pcre2_match_context_copy(pcre2_match_context *); \
609-
PCRE2_EXP_DECL pcre2_match_context PCRE2_CALL_CONVENTION \
610-
*pcre2_match_context_create(pcre2_general_context *); \
617+
PCRE2_EXP_DECL pcre2_match_context *PCRE2_CALL_CONVENTION \
618+
pcre2_match_context_copy(pcre2_match_context *); \
619+
PCRE2_EXP_DECL pcre2_match_context *PCRE2_CALL_CONVENTION \
620+
pcre2_match_context_create(pcre2_general_context *); \
611621
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
612622
pcre2_match_context_free(pcre2_match_context *); \
613623
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
@@ -628,13 +638,13 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
628638
pcre2_set_recursion_limit(pcre2_match_context *, uint32_t); \
629639
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
630640
pcre2_set_recursion_memory_management(pcre2_match_context *, \
631-
void *(*)(PCRE2_SIZE, void *), void (*)(void *, void *), void *);
641+
void *(*)(size_t, void *), void (*)(void *, void *), void *);
632642

633643
#define PCRE2_CONVERT_CONTEXT_FUNCTIONS \
634-
PCRE2_EXP_DECL pcre2_convert_context PCRE2_CALL_CONVENTION \
635-
*pcre2_convert_context_copy(pcre2_convert_context *); \
636-
PCRE2_EXP_DECL pcre2_convert_context PCRE2_CALL_CONVENTION \
637-
*pcre2_convert_context_create(pcre2_general_context *); \
644+
PCRE2_EXP_DECL pcre2_convert_context *PCRE2_CALL_CONVENTION \
645+
pcre2_convert_context_copy(pcre2_convert_context *); \
646+
PCRE2_EXP_DECL pcre2_convert_context *PCRE2_CALL_CONVENTION \
647+
pcre2_convert_context_create(pcre2_general_context *); \
638648
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
639649
pcre2_convert_context_free(pcre2_convert_context *); \
640650
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
@@ -646,15 +656,15 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
646656
/* Functions concerned with compiling a pattern to PCRE internal code. */
647657

648658
#define PCRE2_COMPILE_FUNCTIONS \
649-
PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \
650-
*pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \
659+
PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
660+
pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \
651661
pcre2_compile_context *); \
652662
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
653663
pcre2_code_free(pcre2_code *); \
654-
PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \
655-
*pcre2_code_copy(const pcre2_code *); \
656-
PCRE2_EXP_DECL pcre2_code PCRE2_CALL_CONVENTION \
657-
*pcre2_code_copy_with_tables(const pcre2_code *);
664+
PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
665+
pcre2_code_copy(const pcre2_code *); \
666+
PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
667+
pcre2_code_copy_with_tables(const pcre2_code *);
658668

659669

660670
/* Functions that give information about a compiled pattern. */
@@ -670,10 +680,10 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
670680
/* Functions for running a match and inspecting the result. */
671681

672682
#define PCRE2_MATCH_FUNCTIONS \
673-
PCRE2_EXP_DECL pcre2_match_data PCRE2_CALL_CONVENTION \
674-
*pcre2_match_data_create(uint32_t, pcre2_general_context *); \
675-
PCRE2_EXP_DECL pcre2_match_data PCRE2_CALL_CONVENTION \
676-
*pcre2_match_data_create_from_pattern(const pcre2_code *, \
683+
PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
684+
pcre2_match_data_create(uint32_t, pcre2_general_context *); \
685+
PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
686+
pcre2_match_data_create_from_pattern(const pcre2_code *, \
677687
pcre2_general_context *); \
678688
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
679689
pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
@@ -687,10 +697,12 @@ PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
687697
pcre2_get_mark(pcre2_match_data *); \
688698
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
689699
pcre2_get_match_data_size(pcre2_match_data *); \
700+
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
701+
pcre2_get_match_data_heapframes_size(pcre2_match_data *); \
690702
PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
691703
pcre2_get_ovector_count(pcre2_match_data *); \
692-
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
693-
*pcre2_get_ovector_pointer(pcre2_match_data *); \
704+
PCRE2_EXP_DECL PCRE2_SIZE *PCRE2_CALL_CONVENTION \
705+
pcre2_get_ovector_pointer(pcre2_match_data *); \
694706
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
695707
pcre2_get_startchar(pcre2_match_data *);
696708

@@ -722,7 +734,7 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
722734
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
723735
pcre2_substring_number_from_name(const pcre2_code *, PCRE2_SPTR); \
724736
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
725-
pcre2_substring_list_free(PCRE2_SPTR *); \
737+
pcre2_substring_list_free(PCRE2_UCHAR **); \
726738
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
727739
pcre2_substring_list_get(pcre2_match_data *, PCRE2_UCHAR ***, PCRE2_SIZE **);
728740

@@ -770,8 +782,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
770782
uint32_t, pcre2_match_data *, pcre2_match_context *); \
771783
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
772784
pcre2_jit_free_unused_memory(pcre2_general_context *); \
773-
PCRE2_EXP_DECL pcre2_jit_stack PCRE2_CALL_CONVENTION \
774-
*pcre2_jit_stack_create(PCRE2_SIZE, PCRE2_SIZE, pcre2_general_context *); \
785+
PCRE2_EXP_DECL pcre2_jit_stack *PCRE2_CALL_CONVENTION \
786+
pcre2_jit_stack_create(size_t, size_t, pcre2_general_context *); \
775787
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
776788
pcre2_jit_stack_assign(pcre2_match_context *, pcre2_jit_callback, void *); \
777789
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
@@ -783,8 +795,8 @@ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
783795
#define PCRE2_OTHER_FUNCTIONS \
784796
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
785797
pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \
786-
PCRE2_EXP_DECL const uint8_t PCRE2_CALL_CONVENTION \
787-
*pcre2_maketables(pcre2_general_context *); \
798+
PCRE2_EXP_DECL const uint8_t *PCRE2_CALL_CONVENTION \
799+
pcre2_maketables(pcre2_general_context *); \
788800
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
789801
pcre2_maketables_free(pcre2_general_context *, const uint8_t *);
790802

@@ -851,6 +863,7 @@ pcre2_compile are called by application code. */
851863
#define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_)
852864
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
853865
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
866+
#define pcre2_get_match_data_heapframes_size PCRE2_SUFFIX(pcre2_get_match_data_heapframes_size_)
854867
#define pcre2_get_match_data_size PCRE2_SUFFIX(pcre2_get_match_data_size_)
855868
#define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
856869
#define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
@@ -886,6 +899,7 @@ pcre2_compile are called by application code. */
886899
#define pcre2_set_glob_separator PCRE2_SUFFIX(pcre2_set_glob_separator_)
887900
#define pcre2_set_heap_limit PCRE2_SUFFIX(pcre2_set_heap_limit_)
888901
#define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_)
902+
#define pcre2_set_max_varlookbehind PCRE2_SUFFIX(pcre2_set_max_varlookbehind_)
889903
#define pcre2_set_max_pattern_length PCRE2_SUFFIX(pcre2_set_max_pattern_length_)
890904
#define pcre2_set_newline PCRE2_SUFFIX(pcre2_set_newline_)
891905
#define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)

ext/pcre/pcre2lib/pcre2_auto_possess.c

+11-5
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@ matches to an empty string (also represented by a non-zero value). */
560560

561561
for(;;)
562562
{
563+
PCRE2_SPTR bracode;
564+
563565
/* All operations move the code pointer forward.
564566
Therefore infinite recursions are not possible. */
565567

@@ -617,7 +619,8 @@ for(;;)
617619
recursions. (This could be improved by keeping a list of group numbers that
618620
are called by recursion.) */
619621

620-
switch(*(code - GET(code, 1)))
622+
bracode = code - GET(code, 1);
623+
switch(*bracode)
621624
{
622625
case OP_CBRA:
623626
case OP_SCBRA:
@@ -636,16 +639,19 @@ for(;;)
636639
break;
637640

638641
/* Atomic sub-patterns and assertions can always auto-possessify their
639-
last iterator. However, if the group was entered as a result of checking
640-
a previous iterator, this is not possible. */
642+
last iterator except for variable length lookbehinds. However, if the
643+
group was entered as a result of checking a previous iterator, this is
644+
not possible. */
641645

642646
case OP_ASSERT:
643647
case OP_ASSERT_NOT:
644-
case OP_ASSERTBACK:
645-
case OP_ASSERTBACK_NOT:
646648
case OP_ONCE:
647649
return !entered_a_group;
648650

651+
case OP_ASSERTBACK:
652+
case OP_ASSERTBACK_NOT:
653+
return (bracode[1+LINK_SIZE] == OP_VREVERSE)? FALSE : !entered_a_group;
654+
649655
/* Non-atomic assertions - don't possessify last iterator. This needs
650656
more thought. */
651657

0 commit comments

Comments
 (0)