| OLD | NEW |
| 1 Index: source/i18n/rematch.cpp | 1 Index: source/i18n/rematch.cpp |
| 2 =================================================================== | 2 =================================================================== |
| 3 --- source/i18n/rematch.cpp (revision 98343) | 3 --- source/i18n/rematch.cpp (revision 98343) |
| 4 +++ source/i18n/rematch.cpp (working copy) | 4 +++ source/i18n/rematch.cpp (working copy) |
| 5 @@ -5598,6 +5598,7 @@ | 5 @@ -5598,6 +5598,7 @@ |
| 6 const UChar *foldChars = NULL; | 6 const UChar *foldChars = NULL; |
| 7 int32_t foldOffset, foldLength; | 7 int32_t foldOffset, foldLength; |
| 8 UChar32 c; | 8 UChar32 c; |
| 9 + UBool c_is_valid = FALSE; | 9 + UBool c_is_valid = FALSE; |
| 10 | 10 |
| 11 #ifdef REGEX_SMART_BACKTRACKING | 11 #ifdef REGEX_SMART_BACKTRACKING |
| 12 int32_t originalInputIdx = fp->fInputIdx; | 12 int32_t originalInputIdx = fp->fInputIdx; |
| 13 @@ -5607,23 +5608,29 @@ | 13 @@ -5607,23 +5608,31 @@ |
| 14 foldOffset = foldLength = 0; | 14 foldOffset = foldLength = 0; |
| 15 | 15 |
| 16 while (patternChars < patternEnd && success) { | 16 while (patternChars < patternEnd && success) { |
| 17 - if(foldOffset < foldLength) { | 17 - if(foldOffset < foldLength) { |
| 18 - U16_NEXT_UNSAFE(foldChars, foldOffset, c); | 18 - U16_NEXT_UNSAFE(foldChars, foldOffset, c); |
| 19 - } else { | 19 - } else { |
| 20 - U16_NEXT(inputBuf, fp->fInputIdx, fActiveLimit, c); | 20 - U16_NEXT(inputBuf, fp->fInputIdx, fActiveLimit, c); |
| 21 - foldLength = ucase_toFullFolding(csp, c, &foldChars
, U_FOLD_CASE_DEFAULT); | 21 - foldLength = ucase_toFullFolding(csp, c, &foldChars
, U_FOLD_CASE_DEFAULT); |
| 22 - if(foldLength >= 0) { | 22 - if(foldLength >= 0) { |
| 23 - if(foldLength <= UCASE_MAX_STRING_LENGTH) { /
/ !!!: Does not correctly handle chars that fold to 0-length strings | 23 - if(foldLength <= UCASE_MAX_STRING_LENGTH) { /
/ !!!: Does not correctly handle chars that fold to 0-length strings |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 + if(foldLength >= 0) { | 39 + if(foldLength >= 0) { |
| 40 + if(foldLength <= UCASE_MAX_STRING_LENGTH) {
// !!!: Does not correctly handle chars that fold to 0-length strings | 40 + if(foldLength <= UCASE_MAX_STRING_LENGTH) {
// !!!: Does not correctly handle chars that fold to 0-length strings |
| 41 + foldOffset = 0; | 41 + foldOffset = 0; |
| 42 + U16_NEXT_UNSAFE(foldChars, foldOffset,
c); | 42 + U16_NEXT_UNSAFE(foldChars, foldOffset,
c); |
| 43 + } else { | 43 + } else { |
| 44 + c = foldLength; | 44 + c = foldLength; |
| 45 + foldLength = foldOffset; // to avoid re
ading chars from the folding buffer | 45 + foldLength = foldOffset; // to avoid re
ading chars from the folding buffer |
| 46 + } | 46 + } |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 + } else { |
| 50 + c_is_valid = FALSE; |
| 49 } | 51 } |
| 50 | 52 |
| 51 - if (fp->fInputIdx <= fActiveLimit) { | 53 - if (fp->fInputIdx <= fActiveLimit) { |
| 52 + if (fp->fInputIdx <= fActiveLimit && c_is_valid) { | 54 + if (fp->fInputIdx <= fActiveLimit && c_is_valid) { |
| 53 if (U_IS_BMP(c)) { | 55 if (U_IS_BMP(c)) { |
| 54 success = (*patternChars == c); | 56 success = (*patternChars == c); |
| 55 patternChars += 1; | 57 patternChars += 1; |
| 56 @@ -6070,4 +6077,3 @@ | 58 @@ -6070,4 +6079,3 @@ |
| 57 U_NAMESPACE_END | 59 U_NAMESPACE_END |
| 58 | 60 |
| 59 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS | 61 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS |
| 60 - | 62 - |
| OLD | NEW |