/[pcre]/code/trunk/pcre_dfa_exec.c
ViewVC logotype

Diff of /code/trunk/pcre_dfa_exec.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 535 by ph10, Thu Jun 3 19:18:24 2010 UTC revision 569 by ph10, Sun Nov 7 16:14:50 2010 UTC
# Line 831  for (;;) Line 831  for (;;)
831    
832        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
833        case OP_EOD:        case OP_EOD:
834        if (ptr >= end_subject) { ADD_ACTIVE(state_offset + 1, 0); }        if (ptr >= end_subject)
835            {
836            if ((md->moptions & PCRE_PARTIAL_HARD) != 0)
837              could_continue = TRUE;
838            else { ADD_ACTIVE(state_offset + 1, 0); }
839            }
840        break;        break;
841    
842        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
# Line 871  for (;;) Line 876  for (;;)
876    
877        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
878        case OP_EODN:        case OP_EODN:
879        if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - md->nllen))        if (clen == 0 && (md->moptions & PCRE_PARTIAL_HARD) != 0)
880            could_continue = TRUE;
881          else if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - md->nllen))
882          { ADD_ACTIVE(state_offset + 1, 0); }          { ADD_ACTIVE(state_offset + 1, 0); }
883        break;        break;
884    
# Line 879  for (;;) Line 886  for (;;)
886        case OP_DOLL:        case OP_DOLL:
887        if ((md->moptions & PCRE_NOTEOL) == 0)        if ((md->moptions & PCRE_NOTEOL) == 0)
888          {          {
889          if (clen == 0 ||          if (clen == 0 && (md->moptions & PCRE_PARTIAL_HARD) != 0)
890              could_continue = TRUE;
891            else if (clen == 0 ||
892              ((md->poptions & PCRE_DOLLAR_ENDONLY) == 0 && IS_NEWLINE(ptr) &&              ((md->poptions & PCRE_DOLLAR_ENDONLY) == 0 && IS_NEWLINE(ptr) &&
893                 ((ims & PCRE_MULTILINE) != 0 || ptr == end_subject - md->nllen)                 ((ims & PCRE_MULTILINE) != 0 || ptr == end_subject - md->nllen)
894              ))              ))
# Line 2744  for (;;) Line 2753  for (;;)
2753          ((md->moptions & PCRE_PARTIAL_SOFT) != 0 &&  /* Soft partial and */          ((md->moptions & PCRE_PARTIAL_SOFT) != 0 &&  /* Soft partial and */
2754           match_count < 0)                            /* no matches */           match_count < 0)                            /* no matches */
2755          ) &&                                         /* And... */          ) &&                                         /* And... */
2756          ptr >= end_subject &&                     /* Reached end of subject */          ptr >= end_subject &&                  /* Reached end of subject */
2757          ptr > current_subject)                    /* Matched non-empty string */          ptr > md->start_used_ptr)              /* Inspected non-empty string */
2758        {        {
2759        if (offsetcount >= 2)        if (offsetcount >= 2)
2760          {          {
# Line 2835  if (re == NULL || subject == NULL || wor Line 2844  if (re == NULL || subject == NULL || wor
2844     (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL;     (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL;
2845  if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;  if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
2846  if (wscount < 20) return PCRE_ERROR_DFA_WSSIZE;  if (wscount < 20) return PCRE_ERROR_DFA_WSSIZE;
2847    if (start_offset < 0 || start_offset > length) return PCRE_ERROR_BADOFFSET;
2848    
2849  /* We need to find the pointer to any study data before we test for byte  /* We need to find the pointer to any study data before we test for byte
2850  flipping, so we scan the extra_data block first. This may set two fields in the  flipping, so we scan the extra_data block first. This may set two fields in the
# Line 2953  back the character offset. */ Line 2963  back the character offset. */
2963  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2964  if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)  if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
2965    {    {
2966    if (_pcre_valid_utf8((uschar *)subject, length) >= 0)    int tb;
2967      return PCRE_ERROR_BADUTF8;    if ((tb = _pcre_valid_utf8((uschar *)subject, length)) >= 0)
2968        return (tb == length && (options & PCRE_PARTIAL_HARD) != 0)?
2969          PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8;
2970    if (start_offset > 0 && start_offset < length)    if (start_offset > 0 && start_offset < length)
2971      {      {
2972      int tb = ((uschar *)subject)[start_offset];      tb = ((USPTR)subject)[start_offset] & 0xc0;
2973      if (tb > 127)      if (tb == 0x80) return PCRE_ERROR_BADUTF8_OFFSET;
       {  
       tb &= 0xc0;  
       if (tb != 0 && tb != 0xc0) return PCRE_ERROR_BADUTF8_OFFSET;  
       }  
2974      }      }
2975    }    }
2976  #endif  #endif
# Line 3109  for (;;) Line 3117  for (;;)
3117          while (current_subject < end_subject)          while (current_subject < end_subject)
3118            {            {
3119            register unsigned int c = *current_subject;            register unsigned int c = *current_subject;
3120            if ((start_bits[c/8] & (1 << (c&7))) == 0) current_subject++;            if ((start_bits[c/8] & (1 << (c&7))) == 0)
3121              else break;              {
3122                current_subject++;
3123    #ifdef SUPPORT_UTF8
3124                if (utf8)
3125                  while(current_subject < end_subject &&
3126                        (*current_subject & 0xc0) == 0x80) current_subject++;
3127    #endif
3128                }
3129              else break;
3130            }            }
3131          }          }
3132        }        }

Legend:
Removed from v.535  
changed lines
  Added in v.569

  ViewVC Help
Powered by ViewVC 1.1.5