Skip to content

Commit d512341

Browse files
committed
Fixed bug #66679 Alignment Bug in PCRE 8.34 upstream
1 parent 6e36ded commit d512341

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ PHP NEWS
4343
. Fixed bug #60509 (pcntl_signal doesn't decrease ref-count of old handler
4444
when setting SIG_DFL). (Julien)
4545

46+
- PCRE:
47+
. Fixed bug #66679 (Alignment Bug in PCRE 8.34 upstream).
48+
(Rainer Jung, Anatol Belski)
49+
4650
- PDO_mysql
4751
. Fixed bug #68424 (Add new PDO mysql connection attr to control multi
4852
statements option). (peter dot wolanin at acquia dot com)

ext/pcre/pcrelib/pcre_compile.c

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3071,7 +3071,7 @@ const pcre_uint32 *ochr_ptr;
30713071
const pcre_uint32 *list_ptr;
30723072
const pcre_uchar *next_code;
30733073
const pcre_uint8 *class_bitset;
3074-
const pcre_uint32 *set1, *set2, *set_end;
3074+
const pcre_uint8 *set1, *set2, *set_end;
30753075
pcre_uint32 chr;
30763076
BOOL accepted, invert_bits;
30773077

@@ -3202,12 +3202,12 @@ for(;;)
32023202
if (base_list[0] == OP_CLASS)
32033203
#endif
32043204
{
3205-
set1 = (pcre_uint32 *)(base_end - base_list[2]);
3205+
set1 = (pcre_uint8 *)(base_end - base_list[2]);
32063206
list_ptr = list;
32073207
}
32083208
else
32093209
{
3210-
set1 = (pcre_uint32 *)(code - list[2]);
3210+
set1 = (pcre_uint8 *)(code - list[2]);
32113211
list_ptr = base_list;
32123212
}
32133213

@@ -3216,41 +3216,38 @@ for(;;)
32163216
{
32173217
case OP_CLASS:
32183218
case OP_NCLASS:
3219-
set2 = (pcre_uint32 *)
3219+
set2 = (pcre_uint8 *)
32203220
((list_ptr == list ? code : base_end) - list_ptr[2]);
32213221
break;
32223222

3223-
/* OP_XCLASS cannot be supported here, because its bitset
3224-
is not necessarily complete. E.g: [a-\0x{200}] is stored
3225-
as a character range, and the appropriate bits are not set. */
3226-
32273223
case OP_NOT_DIGIT:
3228-
invert_bits = TRUE;
3229-
/* Fall through */
3224+
invert_bits = TRUE;
3225+
/* Fall through */
32303226
case OP_DIGIT:
3231-
set2 = (pcre_uint32 *)(cd->cbits + cbit_digit);
3232-
break;
3227+
set2 = (pcre_uint8 *)(cd->cbits + cbit_digit);
3228+
break;
32333229

32343230
case OP_NOT_WHITESPACE:
3235-
invert_bits = TRUE;
3236-
/* Fall through */
3231+
invert_bits = TRUE;
3232+
/* Fall through */
32373233
case OP_WHITESPACE:
3238-
set2 = (pcre_uint32 *)(cd->cbits + cbit_space);
3239-
break;
3234+
set2 = (pcre_uint8 *)(cd->cbits + cbit_space);
3235+
break;
32403236

32413237
case OP_NOT_WORDCHAR:
3242-
invert_bits = TRUE;
3243-
/* Fall through */
3238+
invert_bits = TRUE;
3239+
/* Fall through */
32443240
case OP_WORDCHAR:
3245-
set2 = (pcre_uint32 *)(cd->cbits + cbit_word);
3246-
break;
3241+
set2 = (pcre_uint8 *)(cd->cbits + cbit_word);
3242+
break;
32473243

32483244
default:
32493245
return FALSE;
32503246
}
32513247

3252-
/* Compare 4 bytes to improve speed. */
3253-
set_end = set1 + (32 / 4);
3248+
/* Because the sets are unaligned, we need
3249+
to perform byte comparison here. */
3250+
set_end = set1 + 32;
32543251
if (invert_bits)
32553252
{
32563253
do

0 commit comments

Comments
 (0)