version 1.1.1.2, 2012/02/21 23:50:25
|
version 1.1.1.3, 2012/10/09 09:19:17
|
Line 38 POSSIBILITY OF SUCH DAMAGE.
|
Line 38 POSSIBILITY OF SUCH DAMAGE.
|
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
*/ |
*/ |
|
|
|
|
/* This module contains the external function pcre_dfa_exec(), which is an |
/* This module contains the external function pcre_dfa_exec(), which is an |
alternative matching function that uses a sort of DFA algorithm (not a true |
alternative matching function that uses a sort of DFA algorithm (not a true |
FSM). This is NOT Perl- compatible, but it has advantages in certain | FSM). This is NOT Perl-compatible, but it has advantages in certain |
applications. */ |
applications. */ |
|
|
|
|
Line 282 typedef struct stateblock {
|
Line 281 typedef struct stateblock {
|
int data; /* Some use extra data */ |
int data; /* Some use extra data */ |
} stateblock; |
} stateblock; |
|
|
#define INTS_PER_STATEBLOCK (sizeof(stateblock)/sizeof(int)) | #define INTS_PER_STATEBLOCK (int)(sizeof(stateblock)/sizeof(int)) |
|
|
|
|
#ifdef PCRE_DEBUG |
#ifdef PCRE_DEBUG |
Line 382 for the current character, one for the following chara
|
Line 381 for the current character, one for the following chara
|
next_new_state->count = (y); \ |
next_new_state->count = (y); \ |
next_new_state->data = (z); \ |
next_new_state->data = (z); \ |
next_new_state++; \ |
next_new_state++; \ |
DPRINTF(("%.*sADD_NEW_DATA(%d,%d,%d)\n", rlevel*2-2, SP, (x), (y), (z))); \ | DPRINTF(("%.*sADD_NEW_DATA(%d,%d,%d) line %d\n", rlevel*2-2, SP, \ |
| (x), (y), (z), __LINE__)); \ |
} \ |
} \ |
else return PCRE_ERROR_DFA_WSSIZE |
else return PCRE_ERROR_DFA_WSSIZE |
|
|
Line 424 BOOL utf = (md->poptions & PCRE_UTF8) != 0;
|
Line 424 BOOL utf = (md->poptions & PCRE_UTF8) != 0;
|
BOOL utf = FALSE; |
BOOL utf = FALSE; |
#endif |
#endif |
|
|
|
BOOL reset_could_continue = FALSE; |
|
|
rlevel++; |
rlevel++; |
offsetcount &= (-2); |
offsetcount &= (-2); |
|
|
Line 571 for (;;)
|
Line 573 for (;;)
|
int clen, dlen; |
int clen, dlen; |
unsigned int c, d; |
unsigned int c, d; |
int forced_fail = 0; |
int forced_fail = 0; |
BOOL could_continue = FALSE; | BOOL partial_newline = FALSE; |
| BOOL could_continue = reset_could_continue; |
| reset_could_continue = FALSE; |
|
|
/* Make the new state list into the active state list and empty the |
/* Make the new state list into the active state list and empty the |
new state list. */ |
new state list. */ |
Line 607 for (;;)
|
Line 611 for (;;)
|
|
|
if (ptr < end_subject) |
if (ptr < end_subject) |
{ |
{ |
clen = 1; /* Number of bytes in the character */ | clen = 1; /* Number of data items in the character */ |
#ifdef SUPPORT_UTF |
#ifdef SUPPORT_UTF |
if (utf) { GETCHARLEN(c, ptr, clen); } else |
if (utf) { GETCHARLEN(c, ptr, clen); } else |
#endif /* SUPPORT_UTF */ |
#endif /* SUPPORT_UTF */ |
Line 641 for (;;)
|
Line 645 for (;;)
|
|
|
/* A negative offset is a special case meaning "hold off going to this |
/* A negative offset is a special case meaning "hold off going to this |
(negated) state until the number of characters in the data field have |
(negated) state until the number of characters in the data field have |
been skipped". */ | been skipped". If the could_continue flag was passed over from a previous |
| state, arrange for it to passed on. */ |
|
|
if (state_offset < 0) |
if (state_offset < 0) |
{ |
{ |
Line 650 for (;;)
|
Line 655 for (;;)
|
DPRINTF(("%.*sSkipping this character\n", rlevel*2-2, SP)); |
DPRINTF(("%.*sSkipping this character\n", rlevel*2-2, SP)); |
ADD_NEW_DATA(state_offset, current_state->count, |
ADD_NEW_DATA(state_offset, current_state->count, |
current_state->data - 1); |
current_state->data - 1); |
|
if (could_continue) reset_could_continue = TRUE; |
continue; |
continue; |
} |
} |
else |
else |
Line 689 for (;;)
|
Line 695 for (;;)
|
permitted. |
permitted. |
|
|
We also use this mechanism for opcodes such as OP_TYPEPLUS that take an |
We also use this mechanism for opcodes such as OP_TYPEPLUS that take an |
argument that is not a data character - but is always one byte long. We | argument that is not a data character - but is always one byte long because |
have to take special action to deal with \P, \p, \H, \h, \V, \v and \X in | the values are small. We have to take special action to deal with \P, \p, |
this case. To keep the other cases fast, convert these ones to new opcodes. | \H, \h, \V, \v and \X in this case. To keep the other cases fast, convert |
*/ | these ones to new opcodes. */ |
|
|
if (coptable[codevalue] > 0) |
if (coptable[codevalue] > 0) |
{ |
{ |
Line 783 for (;;)
|
Line 789 for (;;)
|
offsets[0] = (int)(current_subject - start_subject); |
offsets[0] = (int)(current_subject - start_subject); |
offsets[1] = (int)(ptr - start_subject); |
offsets[1] = (int)(ptr - start_subject); |
DPRINTF(("%.*sSet matched string = \"%.*s\"\n", rlevel*2-2, SP, |
DPRINTF(("%.*sSet matched string = \"%.*s\"\n", rlevel*2-2, SP, |
offsets[1] - offsets[0], current_subject)); | offsets[1] - offsets[0], (char *)current_subject)); |
} |
} |
if ((md->moptions & PCRE_DFA_SHORTEST) != 0) |
if ((md->moptions & PCRE_DFA_SHORTEST) != 0) |
{ |
{ |
Line 888 for (;;)
|
Line 894 for (;;)
|
/*-----------------------------------------------------------------*/ |
/*-----------------------------------------------------------------*/ |
case OP_ANY: |
case OP_ANY: |
if (clen > 0 && !IS_NEWLINE(ptr)) |
if (clen > 0 && !IS_NEWLINE(ptr)) |
{ ADD_NEW(state_offset + 1, 0); } | { |
| if (ptr + 1 >= md->end_subject && |
| (md->moptions & (PCRE_PARTIAL_HARD)) != 0 && |
| NLBLOCK->nltype == NLTYPE_FIXED && |
| NLBLOCK->nllen == 2 && |
| c == NLBLOCK->nl[0]) |
| { |
| could_continue = partial_newline = TRUE; |
| } |
| else |
| { |
| ADD_NEW(state_offset + 1, 0); |
| } |
| } |
break; |
break; |
|
|
/*-----------------------------------------------------------------*/ |
/*-----------------------------------------------------------------*/ |
Line 916 for (;;)
|
Line 935 for (;;)
|
(ptr == end_subject - md->nllen) |
(ptr == end_subject - md->nllen) |
)) |
)) |
{ ADD_ACTIVE(state_offset + 1, 0); } |
{ ADD_ACTIVE(state_offset + 1, 0); } |
|
else if (ptr + 1 >= md->end_subject && |
|
(md->moptions & (PCRE_PARTIAL_HARD|PCRE_PARTIAL_SOFT)) != 0 && |
|
NLBLOCK->nltype == NLTYPE_FIXED && |
|
NLBLOCK->nllen == 2 && |
|
c == NLBLOCK->nl[0]) |
|
{ |
|
if ((md->moptions & PCRE_PARTIAL_HARD) != 0) |
|
{ |
|
reset_could_continue = TRUE; |
|
ADD_NEW_DATA(-(state_offset + 1), 0, 1); |
|
} |
|
else could_continue = partial_newline = TRUE; |
|
} |
} |
} |
break; |
break; |
|
|
Line 928 for (;;)
|
Line 960 for (;;)
|
else if (clen == 0 || |
else if (clen == 0 || |
((md->poptions & PCRE_DOLLAR_ENDONLY) == 0 && IS_NEWLINE(ptr))) |
((md->poptions & PCRE_DOLLAR_ENDONLY) == 0 && IS_NEWLINE(ptr))) |
{ ADD_ACTIVE(state_offset + 1, 0); } |
{ ADD_ACTIVE(state_offset + 1, 0); } |
|
else if (ptr + 1 >= md->end_subject && |
|
(md->moptions & (PCRE_PARTIAL_HARD|PCRE_PARTIAL_SOFT)) != 0 && |
|
NLBLOCK->nltype == NLTYPE_FIXED && |
|
NLBLOCK->nllen == 2 && |
|
c == NLBLOCK->nl[0]) |
|
{ |
|
if ((md->moptions & PCRE_PARTIAL_HARD) != 0) |
|
{ |
|
reset_could_continue = TRUE; |
|
ADD_NEW_DATA(-(state_offset + 1), 0, 1); |
|
} |
|
else could_continue = partial_newline = TRUE; |
|
} |
} |
} |
else if (IS_NEWLINE(ptr)) |
else if (IS_NEWLINE(ptr)) |
{ ADD_ACTIVE(state_offset + 1, 0); } |
{ ADD_ACTIVE(state_offset + 1, 0); } |
Line 1090 for (;;)
|
Line 1135 for (;;)
|
if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); } |
if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); } |
if (clen > 0) |
if (clen > 0) |
{ |
{ |
if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || | if (d == OP_ANY && ptr + 1 >= md->end_subject && |
| (md->moptions & (PCRE_PARTIAL_HARD)) != 0 && |
| NLBLOCK->nltype == NLTYPE_FIXED && |
| NLBLOCK->nllen == 2 && |
| c == NLBLOCK->nl[0]) |
| { |
| could_continue = partial_newline = TRUE; |
| } |
| else if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || |
(c < 256 && |
(c < 256 && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
Line 1113 for (;;)
|
Line 1166 for (;;)
|
ADD_ACTIVE(state_offset + 2, 0); |
ADD_ACTIVE(state_offset + 2, 0); |
if (clen > 0) |
if (clen > 0) |
{ |
{ |
if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || | if (d == OP_ANY && ptr + 1 >= md->end_subject && |
| (md->moptions & (PCRE_PARTIAL_HARD)) != 0 && |
| NLBLOCK->nltype == NLTYPE_FIXED && |
| NLBLOCK->nllen == 2 && |
| c == NLBLOCK->nl[0]) |
| { |
| could_continue = partial_newline = TRUE; |
| } |
| else if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || |
(c < 256 && |
(c < 256 && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
Line 1135 for (;;)
|
Line 1196 for (;;)
|
ADD_ACTIVE(state_offset + 2, 0); |
ADD_ACTIVE(state_offset + 2, 0); |
if (clen > 0) |
if (clen > 0) |
{ |
{ |
if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || | if (d == OP_ANY && ptr + 1 >= md->end_subject && |
| (md->moptions & (PCRE_PARTIAL_HARD)) != 0 && |
| NLBLOCK->nltype == NLTYPE_FIXED && |
| NLBLOCK->nllen == 2 && |
| c == NLBLOCK->nl[0]) |
| { |
| could_continue = partial_newline = TRUE; |
| } |
| else if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || |
(c < 256 && |
(c < 256 && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
Line 1155 for (;;)
|
Line 1224 for (;;)
|
count = current_state->count; /* Number already matched */ |
count = current_state->count; /* Number already matched */ |
if (clen > 0) |
if (clen > 0) |
{ |
{ |
if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || | if (d == OP_ANY && ptr + 1 >= md->end_subject && |
| (md->moptions & (PCRE_PARTIAL_HARD)) != 0 && |
| NLBLOCK->nltype == NLTYPE_FIXED && |
| NLBLOCK->nllen == 2 && |
| c == NLBLOCK->nl[0]) |
| { |
| could_continue = partial_newline = TRUE; |
| } |
| else if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || |
(c < 256 && |
(c < 256 && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
Line 1176 for (;;)
|
Line 1253 for (;;)
|
count = current_state->count; /* Number already matched */ |
count = current_state->count; /* Number already matched */ |
if (clen > 0) |
if (clen > 0) |
{ |
{ |
if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || | if (d == OP_ANY && ptr + 1 >= md->end_subject && |
| (md->moptions & (PCRE_PARTIAL_HARD)) != 0 && |
| NLBLOCK->nltype == NLTYPE_FIXED && |
| NLBLOCK->nllen == 2 && |
| c == NLBLOCK->nl[0]) |
| { |
| could_continue = partial_newline = TRUE; |
| } |
| else if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) || |
(c < 256 && |
(c < 256 && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
(d != OP_ANY || !IS_NEWLINE(ptr)) && |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0)) |
Line 1824 for (;;)
|
Line 1909 for (;;)
|
ncount++; |
ncount++; |
nptr += ndlen; |
nptr += ndlen; |
} |
} |
|
if (nptr >= end_subject && (md->moptions & PCRE_PARTIAL_HARD) != 0) |
|
reset_could_continue = TRUE; |
if (++count >= GET2(code, 1)) |
if (++count >= GET2(code, 1)) |
{ ADD_NEW_DATA(-(state_offset + 2 + IMM2_SIZE), 0, ncount); } |
{ ADD_NEW_DATA(-(state_offset + 2 + IMM2_SIZE), 0, ncount); } |
else |
else |
Line 2037 for (;;)
|
Line 2124 for (;;)
|
ncount++; |
ncount++; |
nptr += nclen; |
nptr += nclen; |
} |
} |
|
if (nptr >= end_subject && (md->moptions & PCRE_PARTIAL_HARD) != 0) |
|
reset_could_continue = TRUE; |
ADD_NEW_DATA(-(state_offset + 1), 0, ncount); |
ADD_NEW_DATA(-(state_offset + 1), 0, ncount); |
} |
} |
break; |
break; |
Line 2062 for (;;)
|
Line 2151 for (;;)
|
break; |
break; |
|
|
case 0x000d: |
case 0x000d: |
if (ptr + 1 < end_subject && ptr[1] == 0x0a) | if (ptr + 1 >= end_subject) |
{ |
{ |
|
ADD_NEW(state_offset + 1, 0); |
|
if ((md->moptions & PCRE_PARTIAL_HARD) != 0) |
|
reset_could_continue = TRUE; |
|
} |
|
else if (ptr[1] == 0x0a) |
|
{ |
ADD_NEW_DATA(-(state_offset + 1), 0, 1); |
ADD_NEW_DATA(-(state_offset + 1), 0, 1); |
} |
} |
else |
else |
Line 2171 for (;;)
|
Line 2266 for (;;)
|
break; |
break; |
|
|
/*-----------------------------------------------------------------*/ |
/*-----------------------------------------------------------------*/ |
/* Match a negated single character casefully. This is only used for | /* Match a negated single character casefully. */ |
one-byte characters, that is, we know that d < 256. The character we are | |
checking (c) can be multibyte. */ | |
|
|
case OP_NOT: |
case OP_NOT: |
if (clen > 0 && c != d) { ADD_NEW(state_offset + dlen + 1, 0); } |
if (clen > 0 && c != d) { ADD_NEW(state_offset + dlen + 1, 0); } |
break; |
break; |
|
|
/*-----------------------------------------------------------------*/ |
/*-----------------------------------------------------------------*/ |
/* Match a negated single character caselessly. This is only used for | /* Match a negated single character caselessly. */ |
one-byte characters, that is, we know that d < 256. The character we are | |
checking (c) can be multibyte. */ | |
|
|
case OP_NOTI: |
case OP_NOTI: |
if (clen > 0 && c != d && c != fcc[d]) | if (clen > 0) |
{ ADD_NEW(state_offset + dlen + 1, 0); } | { |
| unsigned int otherd; |
| #ifdef SUPPORT_UTF |
| if (utf && d >= 128) |
| { |
| #ifdef SUPPORT_UCP |
| otherd = UCD_OTHERCASE(d); |
| #endif /* SUPPORT_UCP */ |
| } |
| else |
| #endif /* SUPPORT_UTF */ |
| otherd = TABLE_GET(d, fcc, d); |
| if (c != d && c != otherd) |
| { ADD_NEW(state_offset + dlen + 1, 0); } |
| } |
break; |
break; |
|
|
/*-----------------------------------------------------------------*/ |
/*-----------------------------------------------------------------*/ |
Line 2692 for (;;)
|
Line 2797 for (;;)
|
{ |
{ |
int charcount = local_offsets[rc+1] - local_offsets[rc]; |
int charcount = local_offsets[rc+1] - local_offsets[rc]; |
#ifdef SUPPORT_UTF |
#ifdef SUPPORT_UTF |
const pcre_uchar *p = start_subject + local_offsets[rc]; | if (utf) |
const pcre_uchar *pp = start_subject + local_offsets[rc+1]; | { |
while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--; | const pcre_uchar *p = start_subject + local_offsets[rc]; |
| const pcre_uchar *pp = start_subject + local_offsets[rc+1]; |
| while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--; |
| } |
#endif |
#endif |
if (charcount > 0) |
if (charcount > 0) |
{ |
{ |
Line 2793 for (;;)
|
Line 2901 for (;;)
|
const pcre_uchar *pp = local_ptr; |
const pcre_uchar *pp = local_ptr; |
charcount = (int)(pp - p); |
charcount = (int)(pp - p); |
#ifdef SUPPORT_UTF |
#ifdef SUPPORT_UTF |
while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--; | if (utf) while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--; |
#endif |
#endif |
ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1)); |
ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1)); |
} |
} |
Line 2875 for (;;)
|
Line 2983 for (;;)
|
else |
else |
{ |
{ |
#ifdef SUPPORT_UTF |
#ifdef SUPPORT_UTF |
const pcre_uchar *p = start_subject + local_offsets[0]; | if (utf) |
const pcre_uchar *pp = start_subject + local_offsets[1]; | { |
while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--; | const pcre_uchar *p = start_subject + local_offsets[0]; |
| const pcre_uchar *pp = start_subject + local_offsets[1]; |
| while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--; |
| } |
#endif |
#endif |
ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1)); |
ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1)); |
if (repeat_state_offset >= 0) |
if (repeat_state_offset >= 0) |
Line 2946 for (;;)
|
Line 3057 for (;;)
|
if (new_count <= 0) |
if (new_count <= 0) |
{ |
{ |
if (rlevel == 1 && /* Top level, and */ |
if (rlevel == 1 && /* Top level, and */ |
could_continue && /* Some could go on */ | could_continue && /* Some could go on, and */ |
forced_fail != workspace[1] && /* Not all forced fail & */ |
forced_fail != workspace[1] && /* Not all forced fail & */ |
( /* either... */ |
( /* either... */ |
(md->moptions & PCRE_PARTIAL_HARD) != 0 /* Hard partial */ |
(md->moptions & PCRE_PARTIAL_HARD) != 0 /* Hard partial */ |
Line 2954 for (;;)
|
Line 3065 for (;;)
|
((md->moptions & PCRE_PARTIAL_SOFT) != 0 && /* Soft partial and */ |
((md->moptions & PCRE_PARTIAL_SOFT) != 0 && /* Soft partial and */ |
match_count < 0) /* no matches */ |
match_count < 0) /* no matches */ |
) && /* And... */ |
) && /* And... */ |
ptr >= end_subject && /* Reached end of subject */ | ( |
ptr > md->start_used_ptr) /* Inspected non-empty string */ | partial_newline || /* Either partial NL */ |
| ( /* or ... */ |
| ptr >= end_subject && /* End of subject and */ |
| ptr > md->start_used_ptr) /* Inspected non-empty string */ |
| ) |
| ) |
{ |
{ |
if (offsetcount >= 2) |
if (offsetcount >= 2) |
{ |
{ |
Line 3052 if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
|
Line 3168 if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
|
if (wscount < 20) return PCRE_ERROR_DFA_WSSIZE; |
if (wscount < 20) return PCRE_ERROR_DFA_WSSIZE; |
if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET; |
if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET; |
|
|
/* We need to find the pointer to any study data before we test for byte | /* Check that the first field in the block is the magic number. If it is not, |
flipping, so we scan the extra_data block first. This may set two fields in the | return with PCRE_ERROR_BADMAGIC. However, if the magic number is equal to |
match block, so we must initialize them beforehand. However, the other fields | REVERSED_MAGIC_NUMBER we return with PCRE_ERROR_BADENDIANNESS, which |
in the match block must not be set until after the byte flipping. */ | means that the pattern is likely compiled with different endianness. */ |
|
|
|
if (re->magic_number != MAGIC_NUMBER) |
|
return re->magic_number == REVERSED_MAGIC_NUMBER? |
|
PCRE_ERROR_BADENDIANNESS:PCRE_ERROR_BADMAGIC; |
|
if ((re->flags & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE; |
|
|
|
/* If restarting after a partial match, do some sanity checks on the contents |
|
of the workspace. */ |
|
|
|
if ((options & PCRE_DFA_RESTART) != 0) |
|
{ |
|
if ((workspace[0] & (-2)) != 0 || workspace[1] < 1 || |
|
workspace[1] > (wscount - 2)/INTS_PER_STATEBLOCK) |
|
return PCRE_ERROR_DFA_BADRESTART; |
|
} |
|
|
|
/* Set up study, callout, and table data */ |
|
|
md->tables = re->tables; |
md->tables = re->tables; |
md->callout_data = NULL; |
md->callout_data = NULL; |
|
|
Line 3073 if (extra_data != NULL)
|
Line 3206 if (extra_data != NULL)
|
if ((flags & PCRE_EXTRA_TABLES) != 0) |
if ((flags & PCRE_EXTRA_TABLES) != 0) |
md->tables = extra_data->tables; |
md->tables = extra_data->tables; |
} |
} |
|
|
/* Check that the first field in the block is the magic number. If it is not, |
|
return with PCRE_ERROR_BADMAGIC. However, if the magic number is equal to |
|
REVERSED_MAGIC_NUMBER we return with PCRE_ERROR_BADENDIANNESS, which |
|
means that the pattern is likely compiled with different endianness. */ |
|
|
|
if (re->magic_number != MAGIC_NUMBER) |
|
return re->magic_number == REVERSED_MAGIC_NUMBER? |
|
PCRE_ERROR_BADENDIANNESS:PCRE_ERROR_BADMAGIC; |
|
if ((re->flags & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE; |
|
|
|
/* Set some local values */ |
/* Set some local values */ |
|
|