Skip to content

upstream: update to pcre2 10.44 release #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions pcre2-sys/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* automatically generated by rust-bindgen 0.69.4 */
/* automatically generated by rust-bindgen 0.70.1 */

pub const PCRE2_MAJOR: u32 = 10;
pub const PCRE2_MINOR: u32 = 43;
pub const PCRE2_DATE: u32 = 2006;
pub const PCRE2_MINOR: u32 = 44;
pub const PCRE2_DATE: u32 = 2011;
pub const PCRE2_ANCHORED: u32 = 2147483648;
pub const PCRE2_NO_UTF_CHECK: u32 = 1073741824;
pub const PCRE2_ENDANCHORED: u32 = 536870912;
Expand Down Expand Up @@ -419,6 +419,12 @@ extern "C" {
arg2: usize,
) -> ::libc::c_int;
}
extern "C" {
pub fn pcre2_set_max_pattern_compiled_length_8(
arg1: *mut pcre2_compile_context_8,
arg2: usize,
) -> ::libc::c_int;
}
extern "C" {
pub fn pcre2_set_max_varlookbehind_8(
arg1: *mut pcre2_compile_context_8,
Expand Down Expand Up @@ -916,6 +922,12 @@ extern "C" {
arg2: usize,
) -> ::libc::c_int;
}
extern "C" {
pub fn pcre2_set_max_pattern_compiled_length_16(
arg1: *mut pcre2_compile_context_16,
arg2: usize,
) -> ::libc::c_int;
}
extern "C" {
pub fn pcre2_set_max_varlookbehind_16(
arg1: *mut pcre2_compile_context_16,
Expand Down Expand Up @@ -1419,6 +1431,12 @@ extern "C" {
arg2: usize,
) -> ::libc::c_int;
}
extern "C" {
pub fn pcre2_set_max_pattern_compiled_length_32(
arg1: *mut pcre2_compile_context_32,
arg2: usize,
) -> ::libc::c_int;
}
extern "C" {
pub fn pcre2_set_max_varlookbehind_32(
arg1: *mut pcre2_compile_context_32,
Expand Down
2 changes: 1 addition & 1 deletion pcre2-sys/update-pcre2
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pcre2_sys_dir="$(dirname "$0")"
cd "$pcre2_sys_dir"

dest="upstream"
version="10.43"
version="10.44"
dir="pcre2-$version"
archive="$dir.tar.gz"
url="https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$version/$archive"
Expand Down
8 changes: 4 additions & 4 deletions pcre2-sys/upstream/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ sure both macros are undefined; an emulation function will then be used. */
Care must be taken if it is increased, because it guards against integer
overflow caused by enormously large patterns. */
#ifndef MAX_NAME_SIZE
#define MAX_NAME_SIZE 32
#define MAX_NAME_SIZE 128
#endif

/* The value of MAX_VARLOOKBEHIND specifies the default maximum length, in
Expand Down Expand Up @@ -245,7 +245,7 @@ sure both macros are undefined; an emulation function will then be used. */
#define PACKAGE_NAME "PCRE2"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "PCRE2 10.43"
#define PACKAGE_STRING "PCRE2 10.44"

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

/* Define to the version of this package. */
#define PACKAGE_VERSION "10.43"
#define PACKAGE_VERSION "10.44"

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

/* Version number of package */
#define VERSION "10.43"
#define VERSION "10.44"

/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
Expand Down
7 changes: 5 additions & 2 deletions pcre2-sys/upstream/include/pcre2.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */

#define PCRE2_MAJOR 10
#define PCRE2_MINOR 43
#define PCRE2_MINOR 44
#define PCRE2_PRERELEASE
#define PCRE2_DATE 2024-02-16
#define PCRE2_DATE 2024-06-07

/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
Expand Down Expand Up @@ -603,6 +603,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_max_pattern_length(pcre2_compile_context *, PCRE2_SIZE); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_max_pattern_compiled_length(pcre2_compile_context *, PCRE2_SIZE); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_max_varlookbehind(pcre2_compile_context *, uint32_t); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
Expand Down Expand Up @@ -901,6 +903,7 @@ pcre2_compile are called by application code. */
#define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_)
#define pcre2_set_max_varlookbehind PCRE2_SUFFIX(pcre2_set_max_varlookbehind_)
#define pcre2_set_max_pattern_length PCRE2_SUFFIX(pcre2_set_max_pattern_length_)
#define pcre2_set_max_pattern_compiled_length PCRE2_SUFFIX(pcre2_set_max_pattern_compiled_length_)
#define pcre2_set_newline PCRE2_SUFFIX(pcre2_set_newline_)
#define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
#define pcre2_set_offset_limit PCRE2_SUFFIX(pcre2_set_offset_limit_)
Expand Down
27 changes: 18 additions & 9 deletions pcre2-sys/upstream/src/pcre2_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-2023 University of Cambridge
New API code Copyright (c) 2016-2024 University of Cambridge

-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -808,7 +808,8 @@ enum { ERR0 = COMPILE_ERROR_BASE,
ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69, ERR70,
ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79, ERR80,
ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERR87, ERR88, ERR89, ERR90,
ERR91, ERR92, ERR93, ERR94, ERR95, ERR96, ERR97, ERR98, ERR99, ERR100 };
ERR91, ERR92, ERR93, ERR94, ERR95, ERR96, ERR97, ERR98, ERR99, ERR100,
ERR101 };

/* This is a table of start-of-pattern options such as (*UTF) and settings such
as (*LIMIT_MATCH=nnnn) and (*CRLF). For completeness and backward
Expand Down Expand Up @@ -7549,7 +7550,8 @@ for (;; pptr++)
if (lengthptr != NULL)
{
PCRE2_SIZE delta;
if (PRIV(ckd_smul)(&delta, repeat_min - 1, length_prevgroup) ||
if (PRIV(ckd_smul)(&delta, repeat_min - 1,
(int)length_prevgroup) ||
OFLOW_MAX - *lengthptr < delta)
{
*errorcodeptr = ERR20;
Expand Down Expand Up @@ -7599,7 +7601,7 @@ for (;; pptr++)
{
PCRE2_SIZE delta;
if (PRIV(ckd_smul)(&delta, repeat_max,
length_prevgroup + 1 + 2 + 2*LINK_SIZE) ||
(int)length_prevgroup + 1 + 2 + 2*LINK_SIZE) ||
OFLOW_MAX + (2 + 2*LINK_SIZE) - *lengthptr < delta)
{
*errorcodeptr = ERR20;
Expand Down Expand Up @@ -9908,7 +9910,7 @@ do
*bptr |= branchlength; /* branchlength never more than 65535 */
bptr = *pptrptr;
}
while (*bptr == META_ALT);
while (META_CODE(*bptr) == META_ALT);

/* If any branch is of variable length, the whole lookbehind is of variable
length. If the maximum length of any branch exceeds the maximum for variable
Expand Down Expand Up @@ -10601,14 +10603,21 @@ if (length > MAX_PATTERN_SIZE)
goto HAD_CB_ERROR;
}

/* Compute the size of, and then get and initialize, the data block for storing
the compiled pattern and names table. Integer overflow should no longer be
possible because nowadays we limit the maximum value of cb.names_found and
cb.name_entry_size. */
/* Compute the size of, then, if not too large, get and initialize the data
block for storing the compiled pattern and names table. Integer overflow should
no longer be possible because nowadays we limit the maximum value of
cb.names_found and cb.name_entry_size. */

re_blocksize = sizeof(pcre2_real_code) +
CU2BYTES(length +
(PCRE2_SIZE)cb.names_found * (PCRE2_SIZE)cb.name_entry_size);

if (re_blocksize > ccontext->max_pattern_compiled_length)
{
errorcode = ERR101;
goto HAD_CB_ERROR;
}

re = (pcre2_real_code *)
ccontext->memctl.malloc(re_blocksize, ccontext->memctl.memory_data);
if (re == NULL)
Expand Down
10 changes: 9 additions & 1 deletion pcre2-sys/upstream/src/pcre2_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-2023 University of Cambridge
New API code Copyright (c) 2016-2024 University of Cambridge

-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -136,6 +136,7 @@ const pcre2_compile_context PRIV(default_compile_context) = {
NULL, /* Stack guard data */
PRIV(default_tables), /* Character tables */
PCRE2_UNSET, /* Max pattern length */
PCRE2_UNSET, /* Max pattern compiled length */
BSR_DEFAULT, /* Backslash R default */
NEWLINE_DEFAULT, /* Newline convention */
PARENS_NEST_LIMIT, /* As it says */
Expand Down Expand Up @@ -352,6 +353,13 @@ ccontext->max_pattern_length = length;
return 0;
}

PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_max_pattern_compiled_length(pcre2_compile_context *ccontext, PCRE2_SIZE length)
{
ccontext->max_pattern_compiled_length = length;
return 0;
}

PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_newline(pcre2_compile_context *ccontext, uint32_t newline)
{
Expand Down
3 changes: 2 additions & 1 deletion pcre2-sys/upstream/src/pcre2_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-2023 University of Cambridge
New API code Copyright (c) 2016-2024 University of Cambridge

-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -189,6 +189,7 @@ static const unsigned char compile_error_texts[] =
"\\K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)\0"
/* 100 */
"branch too long in variable-length lookbehind assertion\0"
"compiled pattern would be longer than the limit set by the application\0"
;

/* Match-time and UTF error texts are in the same format. */
Expand Down
28 changes: 21 additions & 7 deletions pcre2-sys/upstream/src/pcre2_extuni.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-2021 University of Cambridge
New API code Copyright (c) 2016-2024 University of Cambridge

-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -75,7 +75,11 @@ return NULL;
* Match an extended grapheme sequence *
*************************************************/

/*
/* NOTE: The logic contained in this function is replicated in three special-
purpose functions in the pcre2_jit_compile.c module. If the logic below is
changed, they must be kept in step so that the interpreter and the JIT have the
same behaviour.

Arguments:
c the first character
eptr pointer to next character
Expand All @@ -92,6 +96,7 @@ PCRE2_SPTR
PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject,
PCRE2_SPTR end_subject, BOOL utf, int *xcount)
{
BOOL was_ep_ZWJ = FALSE;
int lgb = UCD_GRAPHBREAK(c);

while (eptr < end_subject)
Expand All @@ -102,6 +107,12 @@ while (eptr < end_subject)
rgb = UCD_GRAPHBREAK(c);
if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;

/* ZWJ followed by Extended Pictographic is allowed only if the ZWJ was
preceded by Extended Pictographic. */

if (lgb == ucp_gbZWJ && rgb == ucp_gbExtended_Pictographic && !was_ep_ZWJ)
break;

/* Not breaking between Regional Indicators is allowed only if there
are an even number of preceding RIs. */

Expand Down Expand Up @@ -129,12 +140,15 @@ while (eptr < end_subject)
if ((ricount & 1) != 0) break; /* Grapheme break required */
}

/* If Extend or ZWJ follows Extended_Pictographic, do not update lgb; this
allows any number of them before a following Extended_Pictographic. */
/* Set a flag when ZWJ follows Extended Pictographic (with optional Extend in
between; see next statement). */

was_ep_ZWJ = (lgb == ucp_gbExtended_Pictographic && rgb == ucp_gbZWJ);

/* If Extend follows Extended_Pictographic, do not update lgb; this allows
any number of them before a following ZWJ. */

if ((rgb != ucp_gbExtend && rgb != ucp_gbZWJ) ||
lgb != ucp_gbExtended_Pictographic)
lgb = rgb;
if (rgb != ucp_gbExtend || lgb != ucp_gbExtended_Pictographic) lgb = rgb;

eptr += len;
if (xcount != NULL) *xcount += 1;
Expand Down
3 changes: 2 additions & 1 deletion pcre2-sys/upstream/src/pcre2_intmodedep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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-2023 University of Cambridge
New API code Copyright (c) 2016-2024 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -568,6 +568,7 @@ typedef struct pcre2_real_compile_context {
void *stack_guard_data;
const uint8_t *tables;
PCRE2_SIZE max_pattern_length;
PCRE2_SIZE max_pattern_compiled_length;
uint16_t bsr_convention;
uint16_t newline_convention;
uint32_t parens_nest_limit;
Expand Down
Loading
Loading