mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-22797 Move the loop limit before ignore continue
Fix an infinity loop issue inside collation builder
This commit is contained in:
parent
64f529e113
commit
09dce103f2
1 changed files with 2 additions and 2 deletions
|
@ -1138,12 +1138,12 @@ CollationBuilder::addOnlyClosure(const UnicodeString &nfdPrefix, const UnicodeSt
|
|||
for(;;) {
|
||||
UnicodeString str = stringIter.next();
|
||||
if(str.isBogus()) { break; }
|
||||
if(ignoreString(str, errorCode) || str == nfdString) { continue; }
|
||||
if (loop++ > kClosureLoopLimit) {
|
||||
// To avoid hang as in ICU-22517, return with error.
|
||||
errorCode = U_INPUT_TOO_LONG_ERROR;
|
||||
return ce32;
|
||||
}
|
||||
if(ignoreString(str, errorCode) || str == nfdString) { continue; }
|
||||
ce32 = addIfDifferent(prefix, str, newCEs, newCEsLength, ce32, errorCode);
|
||||
if(U_FAILURE(errorCode)) { return ce32; }
|
||||
}
|
||||
|
@ -1159,12 +1159,12 @@ CollationBuilder::addOnlyClosure(const UnicodeString &nfdPrefix, const UnicodeSt
|
|||
for(;;) {
|
||||
UnicodeString str = stringIter.next();
|
||||
if(str.isBogus()) { break; }
|
||||
if(ignoreString(str, errorCode) || (samePrefix && str == nfdString)) { continue; }
|
||||
if (loop++ > kClosureLoopLimit) {
|
||||
// To avoid hang as in ICU-22517, return with error.
|
||||
errorCode = U_INPUT_TOO_LONG_ERROR;
|
||||
return ce32;
|
||||
}
|
||||
if(ignoreString(str, errorCode) || (samePrefix && str == nfdString)) { continue; }
|
||||
ce32 = addIfDifferent(prefix, str, newCEs, newCEsLength, ce32, errorCode);
|
||||
if(U_FAILURE(errorCode)) { return ce32; }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue