int this_len = len;
int this_len_byte = len_byte;
unsigned char *p = pat;
- if (pos + len > lim)
+ if (pos + len > lim || pos_byte + len_byte > lim_byte)
goto stop;
while (this_len > 0)
{
/* Try matching at position POS. */
int this_pos = pos - len;
- int this_pos_byte;
+ int this_pos_byte = CHAR_TO_BYTE (this_pos);
int this_len = len;
int this_len_byte = len_byte;
unsigned char *p = pat;
- if (pos - len < lim)
+ if (this_pos < lim || this_pos_byte < lim_byte)
goto stop;
- this_pos_byte = CHAR_TO_BYTE (this_pos);
match_byte = pos_byte - this_pos_byte;
while (this_len > 0)
int this_len = len;
unsigned char *p = pat;
- if (this_pos < lim || this_pos_byte < lim_byte)
+ if (this_pos < lim)
goto stop;
while (this_len > 0)