Bail out when CE buffer is exhausted in the backwards iteration.

X-SVN-Rev: 4701
This commit is contained in:
Syn Wee Quek 2001-05-17 21:34:04 +00:00
parent 2b53e9a143
commit ebb67d12c9

View File

@ -2398,6 +2398,7 @@ uint32_t getSpecialPrevCE(const UCollator *coll, uint32_t CE,
uint32_t size;
/* uint32_t firstCE = UCOL_NOT_FOUND;*/
UChar buffer[UCOL_MAX_BUFFER];
uint32_t *endCEBuffer;
UChar *strbuffer;
for(;;)
@ -2505,8 +2506,16 @@ uint32_t getSpecialPrevCE(const UCollator *coll, uint32_t CE,
temp.flags &= ~UCOL_ITER_NORM;
CE = ucol_IGetNextCE(coll, &temp, status);
endCEBuffer = source->CEs + UCOL_EXPAND_CE_BUFFER_SIZE;
while (CE != UCOL_NO_MORE_CES) {
*(source->CEpos ++) = CE;
if (source->CEpos == endCEBuffer) {
/* ran out of CE space, bail.
there's no guarantee of the right character position after
this bail*/
*status = U_BUFFER_OVERFLOW_ERROR;
return UCOL_NULLORDER;
}
CE = ucol_IGetNextCE(coll, &temp, status);
}
freeHeapWritableBuffer(&temp);