ICU-352 disallow bad ranges
X-SVN-Rev: 1458
This commit is contained in:
parent
21f4b2ab47
commit
ed528c7b3a
@ -703,6 +703,14 @@ UnicodeString& UnicodeSet::parse(UnicodeString& pairsBuf /*result*/,
|
|||||||
} else if (lastOp == 0 && !isLiteral && (c == HYPHEN || c == INTERSECTION)) {
|
} else if (lastOp == 0 && !isLiteral && (c == HYPHEN || c == INTERSECTION)) {
|
||||||
lastOp = c;
|
lastOp = c;
|
||||||
} else if (lastOp == HYPHEN) {
|
} else if (lastOp == HYPHEN) {
|
||||||
|
if (lastChar >= c) {
|
||||||
|
// Don't allow redundant (a-a) or empty (b-a) ranges;
|
||||||
|
// these are most likely typos.
|
||||||
|
//throw new IllegalArgumentException("Invalid range " + lastChar +
|
||||||
|
// '-' + c);
|
||||||
|
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||||
|
return pairsBuf;
|
||||||
|
}
|
||||||
addPair(pairsBuf, (UChar)lastChar, c);
|
addPair(pairsBuf, (UChar)lastChar, c);
|
||||||
lastOp = 0;
|
lastOp = 0;
|
||||||
lastChar = -1;
|
lastChar = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user