ICU-2235 swapping code bug fix

X-SVN-Rev: 13750
This commit is contained in:
Markus Scherer 2003-11-19 00:58:12 +00:00
parent aa109b8431
commit dc41bb7735
2 changed files with 2 additions and 2 deletions

View file

@ -1076,7 +1076,7 @@ ucnv_swap(const UDataSwapper *ds,
size=(int32_t)(mbcsHeader.offsetFromUBytes+mbcsHeader.fromUBytesLength);
} else {
/* there is extension data after the base data, see ucnv_ext.h */
if(length<(extOffset+UCNV_EXT_INDEXES_MIN_LENGTH*4)) {
if(length>=0 && length<(extOffset+UCNV_EXT_INDEXES_MIN_LENGTH*4)) {
udata_printError(ds, "ucnv_swap(): too few bytes (%d after headers) for an ICU MBCS .cnv conversion table with extension data\n",
length);
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;

View file

@ -2011,7 +2011,7 @@ uchar_swapNames(const UDataSwapper *ds,
}
/* swap the group table */
count=*((const uint16_t *)(inBytes+groupsOffset));
count=ds->readUInt16(*((const uint16_t *)(inBytes+groupsOffset)));
ds->swapArray16(ds, inBytes+groupsOffset, (int32_t)((1+count*3)*2),
outBytes+groupsOffset, pErrorCode);