#3044: Upgrade PCRE to 8.44

This commit is contained in:
Günter Obiltschnig 2021-04-11 21:08:18 +02:00
parent 98d2ad1ac7
commit 8722e0e38d
4 changed files with 29 additions and 26 deletions

View File

@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */ /* The current PCRE version information. */
#define PCRE_MAJOR 8 #define PCRE_MAJOR 8
#define PCRE_MINOR 43 #define PCRE_MINOR 44
#define PCRE_PRERELEASE #define PCRE_PRERELEASE
#define PCRE_DATE 2019-02-23 #define PCRE_DATE 020-02-12
/* When an application links to a PCRE DLL in Windows, the symbols that are /* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE, the appropriate imported have to be identified as such. When building PCRE, the appropriate

View File

@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language. and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel Written by Philip Hazel
Copyright (c) 1997-2018 University of Cambridge Copyright (c) 1997-2020 University of Cambridge
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -70,7 +70,7 @@ COMPILE_PCREx macro will already be appropriately set. */
/* Macro for setting individual bits in class bitmaps. */ /* Macro for setting individual bits in class bitmaps. */
#define SETBIT(a,b) a[(b)/8] |= (1 << ((b)&7)) #define SETBIT(a,b) a[(b)/8] |= (1U << ((b)&7))
/* Maximum length value to check against when making sure that the integer that /* Maximum length value to check against when making sure that the integer that
holds the compiled pattern length does not overflow. We make it a bit less than holds the compiled pattern length does not overflow. We make it a bit less than
@ -131,8 +131,8 @@ overrun before it actually does run off the end of the data block. */
/* Private flags added to firstchar and reqchar. */ /* Private flags added to firstchar and reqchar. */
#define REQ_CASELESS (1 << 0) /* Indicates caselessness */ #define REQ_CASELESS (1U << 0) /* Indicates caselessness */
#define REQ_VARY (1 << 1) /* Reqchar followed non-literal item */ #define REQ_VARY (1U << 1) /* Reqchar followed non-literal item */
/* Negative values for the firstchar and reqchar flags */ /* Negative values for the firstchar and reqchar flags */
#define REQ_UNSET (-2) #define REQ_UNSET (-2)
#define REQ_NONE (-1) #define REQ_NONE (-1)
@ -3301,7 +3301,7 @@ for(;;)
if ((*xclass_flags & XCL_MAP) == 0) if ((*xclass_flags & XCL_MAP) == 0)
{ {
/* No bits are set for characters < 256. */ /* No bits are set for characters < 256. */
if (list[1] == 0) return TRUE; if (list[1] == 0) return (*xclass_flags & XCL_NOT) == 0;
/* Might be an empty repeat. */ /* Might be an empty repeat. */
continue; continue;
} }
@ -3613,7 +3613,7 @@ for(;;)
if (chr > 255) break; if (chr > 255) break;
class_bitset = (pcre_uint8 *) class_bitset = (pcre_uint8 *)
((list_ptr == list ? code : base_end) - list_ptr[2]); ((list_ptr == list ? code : base_end) - list_ptr[2]);
if ((class_bitset[chr >> 3] & (1 << (chr & 7))) != 0) return FALSE; if ((class_bitset[chr >> 3] & (1U << (chr & 7))) != 0) return FALSE;
break; break;
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8 #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
@ -7132,17 +7132,19 @@ for (;; ptr++)
int n = 0; int n = 0;
ptr++; ptr++;
while(IS_DIGIT(*ptr)) while(IS_DIGIT(*ptr))
{
n = n * 10 + *ptr++ - CHAR_0; n = n * 10 + *ptr++ - CHAR_0;
if (n > 255)
{
*errorcodeptr = ERR38;
goto FAILED;
}
}
if (*ptr != CHAR_RIGHT_PARENTHESIS) if (*ptr != CHAR_RIGHT_PARENTHESIS)
{ {
*errorcodeptr = ERR39; *errorcodeptr = ERR39;
goto FAILED; goto FAILED;
} }
if (n > 255)
{
*errorcodeptr = ERR38;
goto FAILED;
}
*code++ = n; *code++ = n;
PUT(code, 0, (int)(ptr - cd->start_pattern + 1)); /* Pattern offset */ PUT(code, 0, (int)(ptr - cd->start_pattern + 1)); /* Pattern offset */
PUT(code, LINK_SIZE, 0); /* Default length */ PUT(code, LINK_SIZE, 0); /* Default length */
@ -7458,7 +7460,7 @@ for (;; ptr++)
{ {
open_capitem *oc; open_capitem *oc;
recno = GET2(slot, 0); recno = GET2(slot, 0);
cd->backref_map |= (recno < 32)? (1 << recno) : 1; cd->backref_map |= (recno < 32)? (1U << recno) : 1;
if (recno > cd->top_backref) cd->top_backref = recno; if (recno > cd->top_backref) cd->top_backref = recno;
/* Check to see if this back reference is recursive, that it, it /* Check to see if this back reference is recursive, that it, it
@ -7644,8 +7646,8 @@ for (;; ptr++)
/* Can't determine a first byte now */ /* Can't determine a first byte now */
if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE; if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
zerofirstchar = firstchar; zerofirstchar = firstchar;
zerofirstcharflags = firstcharflags; zerofirstcharflags = firstcharflags;
continue; continue;
@ -8069,7 +8071,7 @@ for (;; ptr++)
item_hwm_offset = cd->hwm - cd->start_workspace; item_hwm_offset = cd->hwm - cd->start_workspace;
*code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF; *code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
PUT2INC(code, 0, recno); PUT2INC(code, 0, recno);
cd->backref_map |= (recno < 32)? (1 << recno) : 1; cd->backref_map |= (recno < 32)? (1U << recno) : 1;
if (recno > cd->top_backref) cd->top_backref = recno; if (recno > cd->top_backref) cd->top_backref = recno;
/* Check to see if this back reference is recursive, that it, it /* Check to see if this back reference is recursive, that it, it
@ -8682,7 +8684,7 @@ do {
op == OP_SCBRA || op == OP_SCBRAPOS) op == OP_SCBRA || op == OP_SCBRAPOS)
{ {
int n = GET2(scode, 1+LINK_SIZE); int n = GET2(scode, 1+LINK_SIZE);
int new_map = bracket_map | ((n < 32)? (1 << n) : 1); int new_map = bracket_map | ((n < 32)? (1U << n) : 1);
if (!is_anchored(scode, new_map, cd, atomcount)) return FALSE; if (!is_anchored(scode, new_map, cd, atomcount)) return FALSE;
} }
@ -8694,6 +8696,7 @@ do {
} }
/* Condition; not anchored if no second branch */ /* Condition; not anchored if no second branch */
else if (op == OP_COND) else if (op == OP_COND)
{ {
if (scode[GET(scode,1)] != OP_ALT) return FALSE; if (scode[GET(scode,1)] != OP_ALT) return FALSE;
@ -8809,7 +8812,7 @@ do {
op == OP_SCBRA || op == OP_SCBRAPOS) op == OP_SCBRA || op == OP_SCBRAPOS)
{ {
int n = GET2(scode, 1+LINK_SIZE); int n = GET2(scode, 1+LINK_SIZE);
int new_map = bracket_map | ((n < 32)? (1 << n) : 1); int new_map = bracket_map | ((n < 32)? (1U << n) : 1);
if (!is_startline(scode, new_map, cd, atomcount, inassert)) return FALSE; if (!is_startline(scode, new_map, cd, atomcount, inassert)) return FALSE;
} }

View File

@ -289,7 +289,7 @@ sure both macros are undefined; an emulation function will then be used. */
#define PACKAGE_NAME "PCRE" #define PACKAGE_NAME "PCRE"
/* Define to the full name and version of this package. */ /* Define to the full name and version of this package. */
#define PACKAGE_STRING "PCRE 8.43" #define PACKAGE_STRING "PCRE 8.44"
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "pcre" #define PACKAGE_TARNAME "pcre"
@ -298,7 +298,7 @@ sure both macros are undefined; an emulation function will then be used. */
#define PACKAGE_URL "" #define PACKAGE_URL ""
/* Define to the version of this package. */ /* Define to the version of this package. */
#define PACKAGE_VERSION "8.43" #define PACKAGE_VERSION "8.44"
/* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested /* 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 parentheses (of any kind) in a pattern. This limits the amount of system
@ -400,7 +400,7 @@ sure both macros are undefined; an emulation function will then be used. */
/* #undef SUPPORT_VALGRIND */ /* #undef SUPPORT_VALGRIND */
/* Version number of package */ /* Version number of package */
#define VERSION "8.43" #define VERSION "8.44"
/* Define to empty if `const' does not conform to ANSI C. */ /* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */ /* #undef const */

View File

@ -3937,10 +3937,10 @@ static sljit_s32 character_to_int32(pcre_uchar chr)
sljit_s32 value = (sljit_s32)chr; sljit_s32 value = (sljit_s32)chr;
#if defined COMPILE_PCRE8 #if defined COMPILE_PCRE8
#define SSE2_COMPARE_TYPE_INDEX 0 #define SSE2_COMPARE_TYPE_INDEX 0
return (value << 24) | (value << 16) | (value << 8) | value; return ((unsigned int)value << 24) | ((unsigned int)value << 16) | ((unsigned int)value << 8) | (unsigned int)value;
#elif defined COMPILE_PCRE16 #elif defined COMPILE_PCRE16
#define SSE2_COMPARE_TYPE_INDEX 1 #define SSE2_COMPARE_TYPE_INDEX 1
return (value << 16) | value; return ((unsigned int)value << 16) | value;
#elif defined COMPILE_PCRE32 #elif defined COMPILE_PCRE32
#define SSE2_COMPARE_TYPE_INDEX 2 #define SSE2_COMPARE_TYPE_INDEX 2
return value; return value;
@ -8506,7 +8506,7 @@ if (opcode == OP_ONCE)
/* We temporarily encode the needs_control_head in the lowest bit. /* We temporarily encode the needs_control_head in the lowest bit.
Note: on the target architectures of SLJIT the ((x << 1) >> 1) returns Note: on the target architectures of SLJIT the ((x << 1) >> 1) returns
the same value for small signed numbers (including negative numbers). */ the same value for small signed numbers (including negative numbers). */
BACKTRACK_AS(bracket_backtrack)->u.framesize = (BACKTRACK_AS(bracket_backtrack)->u.framesize << 1) | (needs_control_head ? 1 : 0); BACKTRACK_AS(bracket_backtrack)->u.framesize = ((unsigned int)BACKTRACK_AS(bracket_backtrack)->u.framesize << 1) | (needs_control_head ? 1 : 0);
} }
return cc + repeat_length; return cc + repeat_length;
} }
@ -9001,7 +9001,7 @@ if (exact > 1)
#ifdef SUPPORT_UTF #ifdef SUPPORT_UTF
&& !common->utf && !common->utf
#endif #endif
) && type != OP_ANYNL && type != OP_EXTUNI)
{ {
OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(exact)); OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(exact));
add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_GREATER, TMP1, 0, STR_END, 0)); add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_GREATER, TMP1, 0, STR_END, 0));