Skip to content

Commit 0b43728

Browse files
committed
Merge pull request #70472 from akien-mga/pcre2-10.42
pcre2: Update to upstream version 10.42 (take two)
2 parents c3e5e4e + e289cf7 commit 0b43728

42 files changed

Lines changed: 10053 additions & 5583 deletions

Some content is hidden

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

modules/regex/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
def can_build(env, platform):
2-
return not env["arch"].startswith("rv")
2+
return True
33

44

55
def configure(env):

modules/regex/regex.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ static void *_regex_malloc(PCRE2_SIZE size, void *user) {
4040
}
4141

4242
static void _regex_free(void *ptr, void *user) {
43-
memfree(ptr);
43+
if (ptr) {
44+
memfree(ptr);
45+
}
4446
}
4547

4648
int RegExMatch::_find(const Variant &p_name) const {

thirdparty/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ Exclude:
597597
## pcre2
598598

599599
- Upstream: http://www.pcre.org
600-
- Version: 10.40 (3103b8f20a3b9944b177e812fde29fbfb8b90558, 2022)
600+
- Version: 10.42 (52c08847921a324c804cabf2814549f50bce1265, 2022)
601601
- License: BSD-3-Clause
602602

603603
Files extracted from upstream source:

thirdparty/pcre2/src/config.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ sure both macros are undefined; an emulation function will then be used. */
236236
#define PACKAGE_NAME "PCRE2"
237237

238238
/* Define to the full name and version of this package. */
239-
#define PACKAGE_STRING "PCRE2 10.40"
239+
#define PACKAGE_STRING "PCRE2 10.42"
240240

241241
/* Define to the one symbol short name of this package. */
242242
#define PACKAGE_TARNAME "pcre2"
@@ -245,7 +245,7 @@ sure both macros are undefined; an emulation function will then be used. */
245245
#define PACKAGE_URL ""
246246

247247
/* Define to the version of this package. */
248-
#define PACKAGE_VERSION "10.40"
248+
#define PACKAGE_VERSION "10.42"
249249

250250
/* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
251251
parentheses (of any kind) in a pattern. This limits the amount of system
@@ -438,7 +438,13 @@ sure both macros are undefined; an emulation function will then be used. */
438438
#endif
439439

440440
/* Version number of package */
441-
#define VERSION "10.40"
441+
#define VERSION "10.42"
442+
443+
/* Number of bits in a file offset, on hosts where this is settable. */
444+
/* #undef _FILE_OFFSET_BITS */
445+
446+
/* Define for large files, on AIX-style hosts. */
447+
/* #undef _LARGE_FILES */
442448

443449
/* Define to empty if `const' does not conform to ANSI C. */
444450
/* #undef const */

thirdparty/pcre2/src/pcre2.h

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
4242
/* The current PCRE version information. */
4343

4444
#define PCRE2_MAJOR 10
45-
#define PCRE2_MINOR 40
45+
#define PCRE2_MINOR 42
4646
#define PCRE2_PRERELEASE
47-
#define PCRE2_DATE 2022-04-14
47+
#define PCRE2_DATE 2022-12-11
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
@@ -572,19 +572,19 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION pcre2_config(uint32_t, void *);
572572
/* Functions for manipulating contexts. */
573573

574574
#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 *), \
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 *), \
579579
void (*)(void *, void *), void *); \
580580
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
581581
pcre2_general_context_free(pcre2_general_context *);
582582

583583
#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 *);\
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 *);\
588588
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
589589
pcre2_compile_context_free(pcre2_compile_context *); \
590590
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
@@ -604,10 +604,10 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
604604
int (*)(uint32_t, void *), void *);
605605

606606
#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 *); \
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 *); \
611611
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
612612
pcre2_match_context_free(pcre2_match_context *); \
613613
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
@@ -631,10 +631,10 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
631631
void *(*)(PCRE2_SIZE, void *), void (*)(void *, void *), void *);
632632

633633
#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 *); \
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 *); \
638638
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
639639
pcre2_convert_context_free(pcre2_convert_context *); \
640640
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
@@ -646,15 +646,15 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
646646
/* Functions concerned with compiling a pattern to PCRE internal code. */
647647

648648
#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 *, \
649+
PCRE2_EXP_DECL pcre2_code *PCRE2_CALL_CONVENTION \
650+
pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \
651651
pcre2_compile_context *); \
652652
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
653653
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 *);
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 *);
658658

659659

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

672672
#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 *, \
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 *, \
677677
pcre2_general_context *); \
678678
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
679679
pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
@@ -689,8 +689,8 @@ PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
689689
pcre2_get_match_data_size(pcre2_match_data *); \
690690
PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
691691
pcre2_get_ovector_count(pcre2_match_data *); \
692-
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
693-
*pcre2_get_ovector_pointer(pcre2_match_data *); \
692+
PCRE2_EXP_DECL PCRE2_SIZE *PCRE2_CALL_CONVENTION \
693+
pcre2_get_ovector_pointer(pcre2_match_data *); \
694694
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
695695
pcre2_get_startchar(pcre2_match_data *);
696696

@@ -770,8 +770,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
770770
uint32_t, pcre2_match_data *, pcre2_match_context *); \
771771
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
772772
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 *); \
773+
PCRE2_EXP_DECL pcre2_jit_stack *PCRE2_CALL_CONVENTION \
774+
pcre2_jit_stack_create(PCRE2_SIZE, PCRE2_SIZE, pcre2_general_context *); \
775775
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
776776
pcre2_jit_stack_assign(pcre2_match_context *, pcre2_jit_callback, void *); \
777777
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
@@ -783,8 +783,8 @@ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
783783
#define PCRE2_OTHER_FUNCTIONS \
784784
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
785785
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 *); \
786+
PCRE2_EXP_DECL const uint8_t *PCRE2_CALL_CONVENTION \
787+
pcre2_maketables(pcre2_general_context *); \
788788
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
789789
pcre2_maketables_free(pcre2_general_context *, const uint8_t *);
790790

thirdparty/pcre2/src/pcre2_compile.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,10 @@ PCRE2_SIZE* ref_count;
12661266

12671267
if (code != NULL)
12681268
{
1269+
#ifdef SUPPORT_JIT
12691270
if (code->executable_jit != NULL)
12701271
PRIV(jit_free)(code->executable_jit, &code->memctl);
1272+
#endif
12711273

12721274
if ((code->flags & PCRE2_DEREF_TABLES) != 0)
12731275
{
@@ -2687,7 +2689,7 @@ if ((options & PCRE2_EXTENDED_MORE) != 0) options |= PCRE2_EXTENDED;
26872689
while (ptr < ptrend)
26882690
{
26892691
int prev_expect_cond_assert;
2690-
uint32_t min_repeat, max_repeat;
2692+
uint32_t min_repeat = 0, max_repeat = 0;
26912693
uint32_t set, unset, *optset;
26922694
uint32_t terminator;
26932695
uint32_t prev_meta_quantifier;
@@ -8552,7 +8554,7 @@ do {
85528554
op == OP_SCBRA || op == OP_SCBRAPOS)
85538555
{
85548556
int n = GET2(scode, 1+LINK_SIZE);
8555-
int new_map = bracket_map | ((n < 32)? (1u << n) : 1);
8557+
unsigned int new_map = bracket_map | ((n < 32)? (1u << n) : 1);
85568558
if (!is_startline(scode, new_map, cb, atomcount, inassert)) return FALSE;
85578559
}
85588560

@@ -10620,4 +10622,10 @@ re = NULL;
1062010622
goto EXIT;
1062110623
}
1062210624

10625+
/* These #undefs are here to enable unity builds with CMake. */
10626+
10627+
#undef NLBLOCK /* Block containing newline information */
10628+
#undef PSSTART /* Field containing processed string start */
10629+
#undef PSEND /* Field containing processed string end */
10630+
1062310631
/* End of pcre2_compile.c */

thirdparty/pcre2/src/pcre2_context.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
77
88
Written by Philip Hazel
99
Original API code Copyright (c) 1997-2012 University of Cambridge
10-
New API code Copyright (c) 2016-2018 University of Cambridge
10+
New API code Copyright (c) 2016-2022 University of Cambridge
1111
1212
-----------------------------------------------------------------------------
1313
Redistribution and use in source and binary forms, with or without
@@ -443,8 +443,11 @@ mcontext->offset_limit = limit;
443443
return 0;
444444
}
445445

446-
/* This function became obsolete at release 10.30. It is kept as a synonym for
447-
backwards compatibility. */
446+
/* These functions became obsolete at release 10.30. The first is kept as a
447+
synonym for backwards compatibility. The second now does nothing. Exclude both
448+
from coverage reports. */
449+
450+
/* LCOV_EXCL_START */
448451

449452
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
450453
pcre2_set_recursion_limit(pcre2_match_context *mcontext, uint32_t limit)
@@ -464,6 +467,9 @@ pcre2_set_recursion_memory_management(pcre2_match_context *mcontext,
464467
return 0;
465468
}
466469

470+
/* LCOV_EXCL_STOP */
471+
472+
467473
/* ------------ Convert context ------------ */
468474

469475
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION

thirdparty/pcre2/src/pcre2_convert.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
77
88
Written by Philip Hazel
99
Original API code Copyright (c) 1997-2012 University of Cambridge
10-
New API code Copyright (c) 2016-2018 University of Cambridge
10+
New API code Copyright (c) 2016-2022 University of Cambridge
1111
1212
-----------------------------------------------------------------------------
1313
Redistribution and use in source and binary forms, with or without
@@ -65,9 +65,8 @@ POSSIBILITY OF SUCH DAMAGE.
6565
#define STR_QUERY_s STR_LEFT_PARENTHESIS STR_QUESTION_MARK STR_s STR_RIGHT_PARENTHESIS
6666
#define STR_STAR_NUL STR_LEFT_PARENTHESIS STR_ASTERISK STR_N STR_U STR_L STR_RIGHT_PARENTHESIS
6767

68-
/* States for range and POSIX processing */
68+
/* States for POSIX processing */
6969

70-
enum { RANGE_NOT_STARTED, RANGE_STARTING, RANGE_STARTED };
7170
enum { POSIX_START_REGEX, POSIX_ANCHORED, POSIX_NOT_BRACKET,
7271
POSIX_CLASS_NOT_STARTED, POSIX_CLASS_STARTING, POSIX_CLASS_STARTED };
7372

thirdparty/pcre2/src/pcre2_dfa_match.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Returns: the return from the callout
350350
*/
351351

352352
static int
353-
do_callout(PCRE2_SPTR code, PCRE2_SIZE *offsets, PCRE2_SPTR current_subject,
353+
do_callout_dfa(PCRE2_SPTR code, PCRE2_SIZE *offsets, PCRE2_SPTR current_subject,
354354
PCRE2_SPTR ptr, dfa_match_block *mb, PCRE2_SIZE extracode,
355355
PCRE2_SIZE *lengthptr)
356356
{
@@ -2799,7 +2799,7 @@ for (;;)
27992799
|| code[LINK_SIZE + 1] == OP_CALLOUT_STR)
28002800
{
28012801
PCRE2_SIZE callout_length;
2802-
rrc = do_callout(code, offsets, current_subject, ptr, mb,
2802+
rrc = do_callout_dfa(code, offsets, current_subject, ptr, mb,
28032803
1 + LINK_SIZE, &callout_length);
28042804
if (rrc < 0) return rrc; /* Abandon */
28052805
if (rrc > 0) break; /* Fail this thread */
@@ -3196,7 +3196,7 @@ for (;;)
31963196
case OP_CALLOUT_STR:
31973197
{
31983198
PCRE2_SIZE callout_length;
3199-
rrc = do_callout(code, offsets, current_subject, ptr, mb, 0,
3199+
rrc = do_callout_dfa(code, offsets, current_subject, ptr, mb, 0,
32003200
&callout_length);
32013201
if (rrc < 0) return rrc; /* Abandon */
32023202
if (rrc == 0)
@@ -4057,4 +4057,10 @@ while (rws->next != NULL)
40574057
return rc;
40584058
}
40594059

4060+
/* These #undefs are here to enable unity builds with CMake. */
4061+
4062+
#undef NLBLOCK /* Block containing newline information */
4063+
#undef PSSTART /* Field containing processed string start */
4064+
#undef PSEND /* Field containing processed string end */
4065+
40604066
/* End of pcre2_dfa_match.c */

thirdparty/pcre2/src/pcre2_internal.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,17 @@ not rely on this. */
220220

221221
#define COMPILE_ERROR_BASE 100
222222

223-
/* The initial frames vector for remembering backtracking points in
224-
pcre2_match() is allocated on the system stack, of this size (bytes). The size
225-
must be a multiple of sizeof(PCRE2_SPTR) in all environments, so making it a
226-
multiple of 8 is best. Typical frame sizes are a few hundred bytes (it depends
227-
on the number of capturing parentheses) so 20KiB handles quite a few frames. A
228-
larger vector on the heap is obtained for patterns that need more frames. The
229-
maximum size of this can be limited. */
223+
/* The initial frames vector for remembering pcre2_match() backtracking points
224+
is allocated on the heap, of this size (bytes) or ten times the frame size if
225+
larger, unless the heap limit is smaller. Typical frame sizes are a few hundred
226+
bytes (it depends on the number of capturing parentheses) so 20KiB handles
227+
quite a few frames. A larger vector on the heap is obtained for matches that
228+
need more frames, subject to the heap limit. */
230229

231230
#define START_FRAMES_SIZE 20480
232231

233-
/* Similarly, for DFA matching, an initial internal workspace vector is
234-
allocated on the stack. */
232+
/* For DFA matching, an initial internal workspace vector is allocated on the
233+
stack. The heap is used only if this turns out to be too small. */
235234

236235
#define DFA_START_RWS_SIZE 30720
237236

0 commit comments

Comments
 (0)