mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-1953 backout buffer overflow changes
X-SVN-Rev: 9070
This commit is contained in:
parent
e86598713a
commit
2fab4a8cb7
56 changed files with 21 additions and 1032 deletions
|
@ -517,10 +517,6 @@ RangeDescriptor::~RangeDescriptor() {
|
|||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
void RangeDescriptor::split(UChar32 where, UErrorCode &status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
assert(where>fStartChar && where<=fEndChar);
|
||||
RangeDescriptor *nr = new RangeDescriptor(*this, status);
|
||||
/* test for NULL */
|
||||
|
|
|
@ -915,10 +915,6 @@ U_CAPI void U_EXPORT2
|
|||
ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
||||
UBiDiLevel *levels;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* ubidi_getLevels() checks all of its and our arguments */
|
||||
if((levels=(UBiDiLevel *)ubidi_getLevels(pBiDi, pErrorCode))==NULL) {
|
||||
/* no op */
|
||||
|
@ -931,10 +927,6 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* ubidi_countRuns() checks all of its and our arguments */
|
||||
if(ubidi_countRuns(pBiDi, pErrorCode)<=0) {
|
||||
/* no op */
|
||||
|
|
|
@ -836,7 +836,6 @@ uprv_getMaxValues() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* string casing ------------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
|
@ -1364,10 +1363,6 @@ u_internalStrToLower(UChar *dest, int32_t destCapacity,
|
|||
int32_t srcIndex, destIndex;
|
||||
UChar32 c;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
/* test early, once, if there is a data file */
|
||||
if(!HAVE_DATA) {
|
||||
*pErrorCode=U_FILE_ACCESS_ERROR;
|
||||
|
@ -1565,10 +1560,6 @@ u_internalStrToUpper(UChar *dest, int32_t destCapacity,
|
|||
int32_t srcIndex, destIndex;
|
||||
UChar32 c;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
/* test early, once, if there is a data file */
|
||||
if(!HAVE_DATA) {
|
||||
*pErrorCode=U_FILE_ACCESS_ERROR;
|
||||
|
@ -1854,10 +1845,6 @@ u_internalStrFoldCase(UChar *dest, int32_t destCapacity,
|
|||
int32_t srcIndex, destIndex;
|
||||
UChar32 c;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
/* test early, once, if there is a data file */
|
||||
if(!HAVE_DATA) {
|
||||
*pErrorCode=U_FILE_ACCESS_ERROR;
|
||||
|
|
|
@ -81,10 +81,6 @@ offsetTOCLookupFn(const UDataMemory *pData,
|
|||
const char *tocEntryName,
|
||||
UErrorCode *pErrorCode) {
|
||||
const OffsetTOC *toc = (OffsetTOC *)pData->toc;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
}
|
||||
if(toc!=NULL) {
|
||||
const char *base=(const char *)pData->toc;
|
||||
uint32_t start, limit, number;
|
||||
|
@ -139,10 +135,6 @@ static uint32_t pointerTOCEntryCount(const UDataMemory *pData) {
|
|||
static const DataHeader *pointerTOCLookupFn(const UDataMemory *pData,
|
||||
const char *name,
|
||||
UErrorCode *pErrorCode) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
}
|
||||
if(pData->toc!=NULL) {
|
||||
const PointerTOC *toc = (PointerTOC *)pData->toc;
|
||||
uint32_t start, limit, number;
|
||||
|
|
|
@ -312,11 +312,6 @@ parseConverterOptions(const char *inName,
|
|||
char c;
|
||||
int32_t len = 0;
|
||||
|
||||
/* test for buffer overflows*/
|
||||
if (U_FAILURE (*err)){
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy the converter name itself to cnvName */
|
||||
while((c=*inName)!=0 && c!=UCNV_OPTION_SEP_CHAR) {
|
||||
if (++len>=UCNV_MAX_CONVERTER_NAME_LENGTH) {
|
||||
|
|
|
@ -39,11 +39,6 @@ ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args,
|
|||
int8_t toerr;
|
||||
int32_t i;
|
||||
|
||||
/* test for buffer overflows*/
|
||||
if (U_FAILURE (*err)){
|
||||
return;
|
||||
}
|
||||
|
||||
if((args->targetLimit - args->target) >= length) /* If the buffer fits.. */
|
||||
{
|
||||
uprv_memcpy(args->target, source, length);
|
||||
|
|
|
@ -35,10 +35,6 @@ _UTF16PEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
int32_t count;
|
||||
int32_t sourceIndex = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(length <= 0 && cnv->toUnicodeStatus == 0) {
|
||||
/* no input, nothing to do */
|
||||
return;
|
||||
|
@ -122,10 +118,6 @@ _UTF16PEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
int32_t count;
|
||||
int32_t sourceIndex = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(length <= 0 && cnv->fromUnicodeStatus == 0) {
|
||||
/* no input, nothing to do */
|
||||
return;
|
||||
|
@ -207,10 +199,6 @@ _UTF16OEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
int32_t count;
|
||||
int32_t sourceIndex = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(length <= 0 && cnv->toUnicodeStatus == 0) {
|
||||
/* no input, nothing to do */
|
||||
return;
|
||||
|
@ -303,10 +291,6 @@ _UTF16OEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
int32_t count;
|
||||
int32_t sourceIndex = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(length <= 0 && cnv->fromUnicodeStatus == 0) {
|
||||
/* no input, nothing to do */
|
||||
return;
|
||||
|
|
|
@ -104,10 +104,6 @@ T_UConverter_toUnicode_UTF32_BE(UConverterToUnicodeArgs * args,
|
|||
unsigned char *toUBytes = args->converter->toUBytes;
|
||||
uint32_t ch, i;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
/* UTF-8 returns here for only non-offset, this needs to change.*/
|
||||
if (args->converter->toUnicodeStatus && myTarget < targetLimit)
|
||||
{
|
||||
|
@ -218,10 +214,6 @@ T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
|
|||
uint32_t ch, i;
|
||||
int32_t offsetNum = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if (args->converter->toUnicodeStatus && myTarget < targetLimit)
|
||||
{
|
||||
i = args->converter->toULength; /* restore # of bytes consumed */
|
||||
|
@ -339,10 +331,6 @@ T_UConverter_fromUnicode_UTF32_BE(UConverterFromUnicodeArgs * args,
|
|||
|
||||
temp[0] = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if (args->converter->fromUnicodeStatus)
|
||||
{
|
||||
ch = args->converter->fromUnicodeStatus;
|
||||
|
@ -418,10 +406,6 @@ T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
|
|||
|
||||
temp[0] = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if (args->converter->fromUnicodeStatus)
|
||||
{
|
||||
ch = args->converter->fromUnicodeStatus;
|
||||
|
@ -601,10 +585,6 @@ T_UConverter_toUnicode_UTF32_LE(UConverterToUnicodeArgs * args,
|
|||
unsigned char *toUBytes = args->converter->toUBytes;
|
||||
uint32_t ch, i;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
/* UTF-8 returns here for only non-offset, this needs to change.*/
|
||||
if (args->converter->toUnicodeStatus && myTarget < targetLimit)
|
||||
{
|
||||
|
@ -716,10 +696,6 @@ T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
|
|||
uint32_t ch, i;
|
||||
int32_t offsetNum = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
/* UTF-8 returns here for only non-offset, this needs to change.*/
|
||||
if (args->converter->toUnicodeStatus && myTarget < targetLimit)
|
||||
{
|
||||
|
@ -839,10 +815,6 @@ T_UConverter_fromUnicode_UTF32_LE(UConverterFromUnicodeArgs * args,
|
|||
|
||||
temp[3] = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if (args->converter->fromUnicodeStatus)
|
||||
{
|
||||
ch = args->converter->fromUnicodeStatus;
|
||||
|
@ -918,10 +890,6 @@ T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
|
|||
|
||||
temp[3] = 0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if (args->converter->fromUnicodeStatus)
|
||||
{
|
||||
ch = args->converter->fromUnicodeStatus;
|
||||
|
@ -1166,10 +1134,6 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
*/
|
||||
offsetDelta=0;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
while(source<sourceLimit && U_SUCCESS(*pErrorCode)) {
|
||||
switch(state) {
|
||||
case 0:
|
||||
|
|
|
@ -192,10 +192,6 @@ _UTF7Open(UConverter *cnv,
|
|||
const char *locale,
|
||||
uint32_t options,
|
||||
UErrorCode *pErrorCode) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if((options&0xf)<=1) {
|
||||
cnv->fromUnicodeStatus=(options&0xf)<<28;
|
||||
_UTF7Reset(cnv, UCNV_RESET_BOTH);
|
||||
|
@ -228,10 +224,6 @@ _UTF7ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
int32_t sourceIndex, nextSourceIndex;
|
||||
|
||||
uint8_t b;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
|
||||
|
@ -240,7 +232,6 @@ _UTF7ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
target=pArgs->target;
|
||||
targetLimit=pArgs->targetLimit;
|
||||
offsets=pArgs->offsets;
|
||||
|
||||
/* get the state machine state */
|
||||
{
|
||||
uint32_t status=cnv->toUnicodeStatus;
|
||||
|
@ -526,10 +517,6 @@ _UTF7FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
int8_t base64Counter;
|
||||
UBool inDirectMode;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
|
||||
|
|
|
@ -156,11 +156,7 @@ U_CFUNC void T_UConverter_toUnicode_UTF8 (UConverterToUnicodeArgs * args,
|
|||
UBool isCESU8 = (UBool)(args->converter->sharedData == &_CESU8Data);
|
||||
uint32_t ch, ch2 = 0;
|
||||
int32_t i, inBytes;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Restore size of current sequence */
|
||||
start:
|
||||
if (args->converter->toUnicodeStatus && myTarget < targetLimit)
|
||||
|
@ -311,10 +307,6 @@ U_CFUNC void T_UConverter_toUnicode_UTF8_OFFSETS_LOGIC (UConverterToUnicodeArgs
|
|||
uint32_t ch, ch2 = 0;
|
||||
int32_t i, inBytes;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
/* Restore size of current sequence */
|
||||
start:
|
||||
if (args->converter->toUnicodeStatus && myTarget < targetLimit)
|
||||
|
@ -333,10 +325,7 @@ start:
|
|||
if (ch < 0x80) /* Simple case */
|
||||
{
|
||||
*(myTarget++) = (UChar) ch;
|
||||
/* test for buffer overflows */
|
||||
if (myOffsets != NULL) {
|
||||
*(myOffsets++) = offsetNum++;
|
||||
}
|
||||
*(myOffsets++) = offsetNum++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -401,10 +390,7 @@ morebytes:
|
|||
{
|
||||
/* fits in 16 bits */
|
||||
*(myTarget++) = (UChar) ch;
|
||||
/* test for buffer overflows */
|
||||
if(myOffsets != NULL) {
|
||||
*(myOffsets++) = offsetNum;
|
||||
}
|
||||
*(myOffsets++) = offsetNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -416,10 +402,7 @@ morebytes:
|
|||
if (myTarget < targetLimit)
|
||||
{
|
||||
*(myTarget++) = (UChar)ch;
|
||||
/* test for buffer overflows */
|
||||
if(myOffsets != NULL) {
|
||||
*(myOffsets++) = offsetNum;
|
||||
}
|
||||
*(myOffsets++) = offsetNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -479,10 +462,6 @@ U_CFUNC void T_UConverter_fromUnicode_UTF8 (UConverterFromUnicodeArgs * args,
|
|||
int16_t indexToWrite;
|
||||
char temp[4];
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if (cnv->fromUSurrogateLead && myTarget < targetLimit)
|
||||
{
|
||||
ch = cnv->fromUSurrogateLead;
|
||||
|
@ -648,10 +627,6 @@ U_CFUNC void T_UConverter_fromUnicode_UTF8_OFFSETS_LOGIC (UConverterFromUnicodeA
|
|||
int16_t indexToWrite;
|
||||
char temp[4];
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if (cnv->fromUSurrogateLead && myTarget < targetLimit)
|
||||
{
|
||||
ch = cnv->fromUSurrogateLead;
|
||||
|
@ -669,25 +644,16 @@ U_CFUNC void T_UConverter_fromUnicode_UTF8_OFFSETS_LOGIC (UConverterFromUnicodeA
|
|||
|
||||
if (ch < 0x80) /* Single byte */
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if(myOffsets != NULL) {
|
||||
*(myOffsets++) = offsetNum++;
|
||||
}
|
||||
*(myOffsets++) = offsetNum++;
|
||||
*(myTarget++) = (char) ch;
|
||||
}
|
||||
else if (ch < 0x800) /* Double byte */
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if(myOffsets != NULL) {
|
||||
*(myOffsets++) = offsetNum;
|
||||
}
|
||||
*(myOffsets++) = offsetNum;
|
||||
*(myTarget++) = (char) ((ch >> 6) | 0xc0);
|
||||
if (myTarget < targetLimit)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if(myOffsets != NULL) {
|
||||
*(myOffsets++) = offsetNum++;
|
||||
}
|
||||
*(myOffsets++) = offsetNum++;
|
||||
*(myTarget++) = (char) ((ch & 0x3f) | 0x80);
|
||||
}
|
||||
else
|
||||
|
@ -802,10 +768,7 @@ lowsurrogate:
|
|||
{
|
||||
if (myTarget < targetLimit)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if(myOffsets != NULL) {
|
||||
*(myOffsets++) = offsetNum;
|
||||
}
|
||||
*(myOffsets++) = offsetNum;
|
||||
*(myTarget++) = temp[indexToWrite];
|
||||
}
|
||||
else
|
||||
|
|
|
@ -66,10 +66,6 @@ _HZOpen(UConverter *cnv, const char *name,const char *locale,uint32_t options, U
|
|||
cnv->fromUnicodeStatus= 0;
|
||||
cnv->mode=0;
|
||||
cnv->fromUSurrogateLead=0x0000;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*errorCode)) {
|
||||
return;
|
||||
}
|
||||
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataHZ));
|
||||
if(cnv->extraInfo != NULL){
|
||||
((UConverterDataHZ*)cnv->extraInfo)->gbConverter = ucnv_open("ibm-1386",errorCode);
|
||||
|
@ -149,10 +145,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
|
|||
UChar32 targetUniChar = 0x0000;
|
||||
UChar mySourceChar = 0x0000;
|
||||
UConverterDataHZ* myData=(UConverterDataHZ*)(args->converter->extraInfo);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)){
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -364,11 +357,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
|
|||
UBool isEscapeAppended =FALSE;
|
||||
int len =0;
|
||||
const char* escSeq=NULL;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)){
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -589,11 +578,7 @@ _HZ_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode *e
|
|||
char *p;
|
||||
char buffer[4];
|
||||
p = buffer;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( convData->isTargetUCharDBCS){
|
||||
*p++= UCNV_TILDE;
|
||||
*p++= UCNV_CLOSE_BRACE;
|
||||
|
|
|
@ -130,10 +130,6 @@ static const uint16_t lookupInitialData[][3]={
|
|||
|
||||
static void
|
||||
_ISCIIOpen(UConverter *cnv, const char *name,const char *locale,uint32_t options, UErrorCode *errorCode){
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*errorCode)) {
|
||||
return;
|
||||
}
|
||||
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataISCII));
|
||||
|
||||
if(cnv->extraInfo != NULL) {
|
||||
|
@ -814,10 +810,6 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
|
|||
uint16_t range = 0;
|
||||
UBool deltaChanged = FALSE;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)){
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -1158,10 +1150,6 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
|
|||
UChar32* toUnicodeStatus=NULL;
|
||||
UChar* contextCharToUnicode = NULL;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
if ((args->converter == NULL) || (target < args->target) || (source < args->source)){
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -1247,10 +1235,6 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
|
|||
*contextCharToUnicode=NO_CHAR_MARKER;
|
||||
}
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
/* look at the pre-context and perform special processing */
|
||||
switch(sourceChar){
|
||||
case ISCII_INV:
|
||||
|
|
|
@ -36,10 +36,6 @@ _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
|
||||
int32_t sourceIndex;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
source=(const uint8_t *)pArgs->source;
|
||||
target=pArgs->target;
|
||||
|
@ -161,10 +157,6 @@ _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
UConverterCallbackReason reason;
|
||||
int32_t i;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
source=pArgs->source;
|
||||
|
@ -482,10 +474,6 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
|
||||
int32_t sourceIndex;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
source=(const uint8_t *)pArgs->source;
|
||||
sourceLimit=(const uint8_t *)pArgs->sourceLimit;
|
||||
|
|
|
@ -362,10 +362,6 @@ _MBCSLoad(UConverterSharedData *sharedData,
|
|||
UConverterMBCSTable *mbcsTable=&sharedData->table->mbcs;
|
||||
_MBCSHeader *header=(_MBCSHeader *)raw;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(header->version[0]!=4) {
|
||||
*pErrorCode=U_INVALID_TABLE_FORMAT;
|
||||
return;
|
||||
|
@ -433,10 +429,6 @@ _MBCSOpen(UConverter *cnv,
|
|||
const char *locale,
|
||||
uint32_t options,
|
||||
UErrorCode *pErrorCode) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
_MBCSReset(cnv, UCNV_RESET_BOTH);
|
||||
if(uprv_strstr(name, "gb18030")!=NULL || uprv_strstr(name, "GB18030")!=NULL) {
|
||||
/* set a flag for GB 18030 mode, which changes the callback behavior */
|
||||
|
@ -497,10 +489,7 @@ _MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
UChar c;
|
||||
uint8_t action;
|
||||
UConverterCallbackReason reason;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* use optimized function if possible */
|
||||
cnv=pArgs->converter;
|
||||
if(cnv->sharedData->table->mbcs.countStates==1) {
|
||||
|
@ -801,10 +790,6 @@ _MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
uint8_t action;
|
||||
UConverterCallbackReason reason;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
source=(const uint8_t *)pArgs->source;
|
||||
|
@ -982,10 +967,6 @@ _MBCSSingleToBMPWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
uint8_t action;
|
||||
UConverterCallbackReason reason;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
source=(const uint8_t *)pArgs->source;
|
||||
|
@ -1223,10 +1204,6 @@ _MBCSGetNextUChar(UConverterToUnicodeArgs *pArgs,
|
|||
uint8_t action;
|
||||
UConverterCallbackReason reason;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0xffff;
|
||||
}
|
||||
/* use optimized function if possible */
|
||||
cnv=pArgs->converter;
|
||||
if(cnv->sharedData->table->mbcs.unicodeMask&UCNV_HAS_SURROGATES) {
|
||||
|
@ -1448,10 +1425,6 @@ _MBCSSingleGetNextUChar(UConverterToUnicodeArgs *pArgs,
|
|||
uint8_t action;
|
||||
UConverterCallbackReason reason;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0xffff;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
source=(const uint8_t *)pArgs->source;
|
||||
|
@ -1748,10 +1721,6 @@ _MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
int32_t length, prevLength;
|
||||
uint8_t unicodeMask;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* use optimized function if possible */
|
||||
cnv=pArgs->converter;
|
||||
outputType=cnv->sharedData->table->mbcs.outputType;
|
||||
|
@ -2238,10 +2207,6 @@ _MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
int32_t length, prevLength;
|
||||
uint8_t unicodeMask;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* use optimized function if possible */
|
||||
cnv=pArgs->converter;
|
||||
unicodeMask=cnv->sharedData->table->mbcs.unicodeMask;
|
||||
|
@ -2494,11 +2459,7 @@ _MBCSSingleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
UConverterCallbackReason reason;
|
||||
uint16_t value, minValue;
|
||||
UBool hasSupplementary;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
source=pArgs->source;
|
||||
|
@ -2711,10 +2672,6 @@ _MBCSSingleFromBMPWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
UConverterCallbackReason reason;
|
||||
uint16_t value, minValue;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
source=pArgs->source;
|
||||
|
@ -3135,10 +3092,6 @@ _MBCSGetStarters(const UConverter* cnv,
|
|||
const int32_t *state0=cnv->sharedData->table->mbcs.stateTable[0];
|
||||
int i;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
for(i=0; i<256; ++i) {
|
||||
/* all bytes that cause a state transition from state 0 are lead bytes */
|
||||
starters[i]= (UBool)MBCS_ENTRY_IS_TRANSITION(state0[i]);
|
||||
|
@ -3163,10 +3116,6 @@ _MBCSWriteSub(UConverterFromUnicodeArgs *pArgs,
|
|||
char buffer[4];
|
||||
int32_t length;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* first, select between subChar and subChar1 */
|
||||
if(cnv->subChar1!=0 && cnv->invalidUCharBuffer[0]<=0xff) {
|
||||
/* select subChar1 if it is set (not 0) and the unmappable Unicode code point is up to U+00ff (IBM MBCS behavior) */
|
||||
|
@ -3274,10 +3223,6 @@ fromUCallback(UConverter *cnv,
|
|||
UConverterCallbackReason reason, UErrorCode *pErrorCode) {
|
||||
int32_t i;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(cnv->extraInfo==gb18030Ranges && reason==UCNV_UNASSIGNED) {
|
||||
const uint32_t *range;
|
||||
|
||||
|
@ -3325,10 +3270,6 @@ toUCallback(UConverter *cnv,
|
|||
UConverterCallbackReason reason, UErrorCode *pErrorCode) {
|
||||
int32_t i;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(cnv->extraInfo==gb18030Ranges && reason==UCNV_UNASSIGNED && length==4) {
|
||||
const uint32_t *range;
|
||||
uint32_t linear;
|
||||
|
|
|
@ -191,10 +191,6 @@ _SCSUOpen(UConverter *cnv,
|
|||
const char *locale,
|
||||
uint32_t options,
|
||||
UErrorCode *pErrorCode) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
cnv->extraInfo=uprv_malloc(sizeof(SCSUData));
|
||||
if(cnv->extraInfo!=NULL) {
|
||||
if(locale!=NULL && locale[0]=='j' && locale[1]=='a' && (locale[2]==0 || locale[2]=='_')) {
|
||||
|
@ -238,10 +234,7 @@ _SCSUToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
int32_t sourceIndex, nextSourceIndex;
|
||||
|
||||
uint8_t b;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
scsu=(SCSUData *)cnv->extraInfo;
|
||||
|
@ -632,10 +625,7 @@ _SCSUToUnicode(UConverterToUnicodeArgs *pArgs,
|
|||
int8_t quoteWindow, dynamicWindow;
|
||||
|
||||
uint8_t b;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
scsu=(SCSUData *)cnv->extraInfo;
|
||||
|
@ -1114,10 +1104,6 @@ _SCSUFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
int code;
|
||||
int8_t window;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
scsu=(SCSUData *)cnv->extraInfo;
|
||||
|
@ -1666,10 +1652,6 @@ _SCSUFromUnicode(UConverterFromUnicodeArgs *pArgs,
|
|||
int code;
|
||||
int8_t window;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* set up the local pointers */
|
||||
cnv=pArgs->converter;
|
||||
scsu=(SCSUData *)cnv->extraInfo;
|
||||
|
|
|
@ -493,10 +493,6 @@ static UBool extendICUData(UDataMemory *failedData, UErrorCode *pErr)
|
|||
UDataMemory *pData;
|
||||
UDataMemory copyPData;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErr)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (failedData->vFuncs->NumEntries(failedData) > MAX_STUB_ENTRIES) {
|
||||
/* Not the stub. We can't extend. */
|
||||
return FALSE;
|
||||
|
@ -700,10 +696,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
|
|||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
UBool isICUData= (UBool)(path==NULL);
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Make up a full mame by appending the type to the supplied
|
||||
* name, assuming that a type was supplied.
|
||||
|
|
|
@ -865,10 +865,6 @@ _res_getTableItemWithFallback(const char *path, const char *locale,
|
|||
const char *defaultLocale;
|
||||
UBool lookedAtDefault;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
}
|
||||
*pMainRB=NULL;
|
||||
lookedAtDefault=FALSE;
|
||||
defaultLocale=uloc_getDefault();
|
||||
|
|
|
@ -680,10 +680,6 @@ UnicodeString::doCaseCompare(int32_t start,
|
|||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
int32_t result=unorm_cmpEquivFold(chars, length, srcChars, srcLength,
|
||||
options|U_COMPARE_IGNORE_CASE, &errorCode);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(errorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(result!=0) {
|
||||
return (int8_t)(result >> 24 | 1);
|
||||
}
|
||||
|
|
|
@ -1464,10 +1464,6 @@ unorm_decompose(UChar *dest, int32_t destCapacity,
|
|||
int32_t destIndex;
|
||||
uint8_t trailCC;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(!_haveData(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1651,10 +1647,6 @@ unorm_makeFCD(UChar *dest, int32_t destCapacity,
|
|||
uint16_t fcd16;
|
||||
int16_t prevCC, cc;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(!_haveData(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -2219,10 +2211,6 @@ _composePart(UChar *stackBuffer, UChar *&buffer, int32_t &bufferCapacity, int32_
|
|||
UChar minNoMaybe;
|
||||
uint8_t trailCC;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
decompQCMask=(qcMask<<2)&0xf; /* decomposition quick check mask */
|
||||
|
||||
if(!(decompQCMask&_NORM_QC_NFKD)) {
|
||||
|
@ -2595,10 +2583,6 @@ unorm_compose(UChar *dest, int32_t destCapacity,
|
|||
UErrorCode *pErrorCode) {
|
||||
int32_t destIndex;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(!_haveData(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -2802,10 +2786,6 @@ _findPreviousIterationBoundary(UCharIterator &src,
|
|||
UChar c, c2;
|
||||
UBool isBoundary;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
/* initialize */
|
||||
stackBuffer=buffer;
|
||||
startIndex=bufferCapacity; /* fill the buffer from the end backwards */
|
||||
|
@ -3043,10 +3023,6 @@ _findNextIterationBoundary(UCharIterator &src,
|
|||
int32_t bufferIndex;
|
||||
UChar c, c2;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(!src.hasNext(&src)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -3487,10 +3463,6 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
|
|||
// current code units, and code points for lookups
|
||||
int32_t c1, c2, cp1, cp2;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
// no argument error checking because this itself is not an API
|
||||
|
||||
// assume that at least one of the options _COMPARE_EQUIV and U_COMPARE_IGNORE_CASE is set
|
||||
|
|
|
@ -102,10 +102,6 @@ static const ResourceData *getFallbackData(const UResourceBundle* resBundle, con
|
|||
int32_t indexR = -1;
|
||||
int32_t i = 0;
|
||||
*res = RES_BOGUS;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
if(resB != NULL) {
|
||||
if(resB->fBogus == U_ZERO_ERROR) { /* if this resource is real, */
|
||||
*res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag); /* try to get data from there */
|
||||
|
@ -143,10 +139,6 @@ static const ResourceData *getFallbackData(const UResourceBundle* resBundle, con
|
|||
|
||||
/** INTERNAL: Initializes the cache for resources */
|
||||
static void initCache(UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
if(cache == NULL) {
|
||||
UHashtable *newCache = uhash_open(hashEntry, compareEntries, status);
|
||||
if (U_FAILURE(*status)) {
|
||||
|
@ -231,10 +223,6 @@ UBool ures_cleanup(void)
|
|||
/** INTERNAL: sets the name (locale) of the resource bundle to given name */
|
||||
|
||||
static void setEntryName(UResourceDataEntry *res, char *name, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
if(res->fName != NULL) {
|
||||
uprv_free(res->fName);
|
||||
}
|
||||
|
@ -381,10 +369,6 @@ static UResourceDataEntry *findFirstExisting(const char* path, char* name, UBool
|
|||
const char *defaultLoc = uloc_getDefault();
|
||||
UErrorCode intStatus = U_ZERO_ERROR;
|
||||
*hasChopped = TRUE; /* we're starting with a fresh name */
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while(*hasChopped && !hasRealData) {
|
||||
r = init_entry(name, path, &intStatus);
|
||||
|
@ -428,10 +412,6 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, UEr
|
|||
}
|
||||
|
||||
initCache(status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uprv_strcpy(name, localeID);
|
||||
|
||||
|
@ -446,10 +426,6 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, UEr
|
|||
while (hasChopped && !isRoot && t1->fParent == NULL) {
|
||||
/* insert regular parents */
|
||||
t2 = init_entry(name, r->fPath, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
t1->fParent = t2;
|
||||
t1 = t2;
|
||||
hasChopped = chopLocale(name);
|
||||
|
@ -470,10 +446,6 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, UEr
|
|||
while (hasChopped && t1->fParent == NULL) {
|
||||
/* insert chopped defaults */
|
||||
t2 = init_entry(name, r->fPath, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
t1->fParent = t2;
|
||||
t1 = t2;
|
||||
hasChopped = chopLocale(name);
|
||||
|
@ -496,10 +468,6 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, UEr
|
|||
} else if(!isRoot && uprv_strcmp(t1->fName, kRootLocaleName) != 0 && t1->fParent == NULL) {
|
||||
/* insert root locale */
|
||||
t2 = init_entry(kRootLocaleName, r->fPath, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
if(!hasRealData) {
|
||||
r->fBogus = U_USING_DEFAULT_ERROR;
|
||||
}
|
||||
|
@ -580,10 +548,6 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
|
|||
/* first, open the bundle with real data */
|
||||
UResourceBundle *main = ures_openDirect(path, locale, status);
|
||||
UResourceBundle *result = NULL;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(keyPath == NULL) {
|
||||
/* no key path. This means that we are going to
|
||||
|
@ -616,10 +580,6 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
|
|||
}
|
||||
if(r != RES_BOGUS) {
|
||||
result = init_resb_result(&(main->fResData), r, key, -1, main->fData, parent, noAlias+1, resB, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
result = resB;
|
||||
|
@ -641,10 +601,6 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
|
|||
break;
|
||||
}
|
||||
resB = init_resb_result(&(result->fResData), r, key, -1, result->fData, parent, noAlias+1, resB, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
result = resB;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,10 +199,6 @@ isAcceptable(void *context,
|
|||
U_CFUNC UBool
|
||||
res_load(ResourceData *pResData,
|
||||
const char *path, const char *name, UErrorCode *errorCode) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*errorCode)) {
|
||||
return FALSE;
|
||||
}
|
||||
/* load the ResourceBundle file */
|
||||
pResData->data=udata_openChoice(path, "res", name, isAcceptable, NULL, errorCode);
|
||||
if(U_FAILURE(*errorCode)) {
|
||||
|
|
|
@ -35,10 +35,6 @@ uset_open(UChar32 start, UChar32 end) {
|
|||
U_CAPI USet* U_EXPORT2
|
||||
uset_openPattern(const UChar* pattern, int32_t patternLength,
|
||||
UErrorCode* ec) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*ec)) {
|
||||
return 0;
|
||||
}
|
||||
UnicodeString pat(patternLength==-1, pattern, patternLength);
|
||||
UnicodeSet* set = new UnicodeSet(pat, *ec);
|
||||
/* test for NULL */
|
||||
|
|
|
@ -497,10 +497,6 @@ removeLamAlefSpaces(UChar *dest, int32_t sourceLength,
|
|||
int32_t i = 0, j = 0;
|
||||
int32_t count = 0;
|
||||
UChar *tempbuffer=NULL;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(options&U_SHAPE_LENGTH_MASK) {
|
||||
case U_SHAPE_LENGTH_GROW_SHRINK :
|
||||
|
@ -640,10 +636,6 @@ expandLamAlef(UChar *dest, int32_t sourceLength,
|
|||
int32_t inpsize = sourceLength;
|
||||
UChar lamalefChar;
|
||||
UChar *tempbuffer=NULL;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(options&U_SHAPE_LENGTH_MASK) {
|
||||
|
||||
|
@ -809,10 +801,6 @@ shapeUnicode(UChar *dest, int32_t sourceLength,
|
|||
int32_t lamalef_found = 0;
|
||||
UChar prevLink = 0, lastLink = 0, currLink, nextLink = 0;
|
||||
UChar wLamalef;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts the input buffer from FExx Range into 06xx Range
|
||||
|
@ -946,10 +934,6 @@ deShapeUnicode(UChar *dest, int32_t sourceLength,
|
|||
UErrorCode *pErrorCode) {
|
||||
int32_t i = 0;
|
||||
int32_t lamalef_found = 0;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*This for loop changes the buffer from the Unicode FE range to
|
||||
|
@ -1075,10 +1059,6 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
|
|||
outputSize = 0;
|
||||
break;
|
||||
}
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((options&U_SHAPE_TEXT_DIRECTION_MASK) == U_SHAPE_TEXT_DIRECTION_LOGICAL) {
|
||||
countSpaces(tempbuffer,outputSize,options,&spacesCountl,&spacesCountr);
|
||||
|
|
|
@ -44,10 +44,6 @@ u_internalStrToTitle(UChar *dest, int32_t destCapacity,
|
|||
int32_t prev, index, destIndex, length;
|
||||
UBool isFirstIndex;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
/* set up local variables */
|
||||
uiter_setString(&iter, src, srcLength);
|
||||
destIndex=0;
|
||||
|
@ -84,10 +80,6 @@ u_internalStrToTitle(UChar *dest, int32_t destCapacity,
|
|||
}
|
||||
destIndex+=length;
|
||||
}
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(index>=srcLength) {
|
||||
break;
|
||||
|
|
|
@ -645,10 +645,6 @@ _strFromWCS( UChar *dest,
|
|||
const wchar_t* pSrc = src;
|
||||
const wchar_t* pSrcLimit = NULL;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
}
|
||||
if(srcLength ==-1){
|
||||
/* if the wchar_t source is null terminated we can safely
|
||||
* assume that there are no embedded nulls, this is a fast
|
||||
|
@ -787,10 +783,7 @@ _strFromWCS( UChar *dest,
|
|||
|
||||
/* convert to stack buffer*/
|
||||
ucnv_toUnicode(conv,&pTarget,pTargetLimit,(const char**)&pCSrc,pCSrcLimit,NULL,(UBool)(pCSrc==pCSrcLimit),pErrorCode);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* increment count to number written to stack */
|
||||
count+= pTarget - target;
|
||||
|
||||
|
|
|
@ -379,11 +379,6 @@ utrie_fold(UNewTrie *trie, UNewTrieGetFoldedValue *getFoldedValue, UErrorCode *p
|
|||
UChar32 c;
|
||||
int32_t indexLength, block;
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
index=trie->index;
|
||||
|
||||
/* copy the lead surrogate indexes into a temporary array */
|
||||
|
|
|
@ -58,10 +58,6 @@ UVector::UVector(UObjectDeleter d, UKeyComparator c, int32_t initialCapacity, UE
|
|||
}
|
||||
|
||||
void UVector::_init(int32_t initialCapacity, UErrorCode &status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
// Fix bogus initialCapacity values; avoid malloc(0)
|
||||
if (initialCapacity < 1) {
|
||||
initialCapacity = DEFUALT_CAPACITY;
|
||||
|
@ -294,11 +290,6 @@ int32_t UVector::indexOf(UHashTok key, int32_t startIndex) const {
|
|||
}
|
||||
|
||||
UBool UVector::ensureCapacity(int32_t minimumCapacity, UErrorCode &status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (capacity >= minimumCapacity) {
|
||||
return TRUE;
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* and others. All Rights Reserved.
|
||||
*****************************************************************
|
||||
* $Source: /xsrl/Nsvn/icu/icu/source/i18n/anytrans.cpp,v $
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.9 $
|
||||
*****************************************************************
|
||||
* Date Name Description
|
||||
* 06/06/2002 aliu Creation.
|
||||
|
@ -161,11 +161,6 @@ UBool ScriptRunIterator::next() {
|
|||
}
|
||||
}
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(ec)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Move limit ahead to include COMMON, INHERITED, and characters
|
||||
// of the current script.
|
||||
while (limit < textLimit) {
|
||||
|
@ -181,11 +176,6 @@ UBool ScriptRunIterator::next() {
|
|||
++limit;
|
||||
}
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(ec)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Return TRUE even if the entire text is COMMON / INHERITED, in
|
||||
// which case scriptCode will be USCRIPT_INVALID_CODE.
|
||||
return TRUE;
|
||||
|
@ -210,12 +200,6 @@ AnyTransliterator::AnyTransliterator(const UnicodeString& id,
|
|||
targetScript(theTargetScript)
|
||||
{
|
||||
cache = uhash_open(uhash_hashLong, uhash_compareLong, &ec);
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(ec)) {
|
||||
return;
|
||||
}
|
||||
|
||||
uhash_setValueDeleter(cache, _deleteTransliterator);
|
||||
|
||||
target = theTarget;
|
||||
|
@ -239,12 +223,6 @@ AnyTransliterator::AnyTransliterator(const AnyTransliterator& o) :
|
|||
// Don't copy the cache contents
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
cache = uhash_open(uhash_hashLong, uhash_compareLong, &ec);
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(ec)) {
|
||||
return;
|
||||
}
|
||||
|
||||
uhash_setValueDeleter(cache, _deleteTransliterator);
|
||||
}
|
||||
|
||||
|
@ -331,11 +309,6 @@ Transliterator* AnyTransliterator::getTransliterator(UScriptCode source) const {
|
|||
|
||||
if (t != NULL) {
|
||||
uhash_iput(cache, (int32_t) source, t, &ec);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(ec)) {
|
||||
delete t;
|
||||
t = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,10 +96,6 @@ Calendar::Calendar(UErrorCode& success)
|
|||
fLenient(TRUE),
|
||||
fZone(0)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(success)) {
|
||||
return;
|
||||
}
|
||||
clear();
|
||||
fZone = TimeZone::createDefault();
|
||||
setWeekCountData(Locale::getDefault(), success);
|
||||
|
@ -117,10 +113,6 @@ Calendar::Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success)
|
|||
fLenient(TRUE),
|
||||
fZone(0)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(success)) {
|
||||
return;
|
||||
}
|
||||
if(zone == 0) {
|
||||
success = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -144,10 +136,6 @@ Calendar::Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& succ
|
|||
fLenient(TRUE),
|
||||
fZone(0)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(success)) {
|
||||
return;
|
||||
}
|
||||
clear();
|
||||
fZone = zone.clone();
|
||||
setWeekCountData(aLocale, success);
|
||||
|
@ -731,10 +719,6 @@ Calendar::getMinimalDaysInFirstWeek() const
|
|||
int32_t
|
||||
Calendar::getActualMinimum(EDateFields field, UErrorCode& status) const
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
int32_t fieldValue = getGreatestMinimum(field);
|
||||
int32_t endValue = getMinimum(field);
|
||||
|
||||
|
@ -778,10 +762,6 @@ Calendar::getActualMinimum(EDateFields field, UErrorCode& status) const
|
|||
int32_t
|
||||
Calendar::getActualMaximum(EDateFields field, UErrorCode& status) const
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
int32_t fieldValue = getLeastMaximum(field);
|
||||
int32_t endValue = getMaximum(field);
|
||||
|
||||
|
|
|
@ -380,10 +380,6 @@ void CanonicalIterator::permute(UnicodeString &source, UBool skipZeros, Hashtabl
|
|||
UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status) {
|
||||
//private String[] getEquivalents(String segment)
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
Hashtable *result = new Hashtable(FALSE, status);
|
||||
/* test for NULL */
|
||||
if (result == 0) {
|
||||
|
@ -489,10 +485,6 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
|
|||
Hashtable *CanonicalIterator::getEquivalents2(const UChar *segment, int32_t segLen, UErrorCode &status) {
|
||||
//Hashtable *CanonicalIterator::getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status) {
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
Hashtable *result = new Hashtable(FALSE, status);
|
||||
/* test for NULL */
|
||||
if (result == 0) {
|
||||
|
@ -572,10 +564,6 @@ Hashtable *CanonicalIterator::extract(UChar32 comp, const UChar *segment, int32_
|
|||
//if (PROGRESS) printf(" extract: %s, ", UToS(Tr(UnicodeString(comp))));
|
||||
//if (PROGRESS) printf("%s, %i\n", UToS(Tr(segment)), segmentPos);
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
const int32_t bufSize = 256;
|
||||
int32_t bufLen = 0;
|
||||
UChar temp[bufSize];
|
||||
|
|
|
@ -613,11 +613,6 @@ ChoiceFormat::format(const Formattable* objs,
|
|||
FieldPosition& pos,
|
||||
UErrorCode& status) const
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return toAppendTo;
|
||||
}
|
||||
|
||||
if(cnt < 0) {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return toAppendTo;
|
||||
|
|
|
@ -98,11 +98,6 @@ Collator *
|
|||
Collator::createInstance(const Locale &loc,
|
||||
UVersionInfo version,
|
||||
UErrorCode &status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Collator *collator;
|
||||
UVersionInfo info;
|
||||
|
||||
|
|
|
@ -152,21 +152,13 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
|
|||
currencyElements[i] = currencyElementsRes.getStringEx(i, status);
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
/* clean the memory */
|
||||
delete[] numberElements;
|
||||
delete[] currencyElements;
|
||||
return;
|
||||
}
|
||||
if (U_FAILURE(status)) return;
|
||||
|
||||
// If the array size is too small, something is wrong with the resource
|
||||
// bundle, returns the failure error code.
|
||||
if (numberElementsLength < 11 ||
|
||||
currencyElementsLength < 3) {
|
||||
status = U_INVALID_FORMAT_ERROR;
|
||||
/* clean the memory */
|
||||
delete[] numberElements;
|
||||
delete[] currencyElements;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -194,10 +194,6 @@ DecimalFormat::construct(UErrorCode& status,
|
|||
const UnicodeString* pattern,
|
||||
DecimalFormatSymbols* symbolsToAdopt)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
fSymbols = symbolsToAdopt; // Do this BEFORE aborting on status failure!!!
|
||||
// fDigitList = new DigitList(); // Do this BEFORE aborting on status failure!!!
|
||||
fRoundingIncrement = NULL;
|
||||
|
@ -1458,11 +1454,6 @@ DecimalFormat::setCurrencyForSymbols() {
|
|||
UErrorCode ec = U_ZERO_ERROR;
|
||||
DecimalFormatSymbols def(fSymbols->getLocale(), ec);
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(ec)) {
|
||||
currency[0] = 0; // Use DFS currency info
|
||||
}
|
||||
|
||||
if (fSymbols->getSymbol(DecimalFormatSymbols::kCurrencySymbol) ==
|
||||
def.getSymbol(DecimalFormatSymbols::kCurrencySymbol) &&
|
||||
fSymbols->getSymbol(DecimalFormatSymbols::kIntlCurrencySymbol) ==
|
||||
|
|
|
@ -578,11 +578,6 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, UBoo
|
|||
ResourceBundle zoneArray = resource.get(fgZoneStringsTag, status);
|
||||
fZoneStringsRowCount = zoneArray.getSize();
|
||||
ResourceBundle zoneRow = zoneArray.get((int32_t)0, status);
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
/* TODO: Fix the case where the zoneStrings is not a perfect square array of information. */
|
||||
fZoneStringsColCount = zoneRow.getSize();
|
||||
fZoneStrings = new UnicodeString * [fZoneStringsRowCount];
|
||||
|
@ -606,10 +601,6 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, UBoo
|
|||
|
||||
// {sfb} fixed to handle 1-based weekdays
|
||||
ResourceBundle weekdaysData = resource.get(fgDayNamesTag, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
fWeekdaysCount = weekdaysData.getSize();
|
||||
fWeekdays = new UnicodeString[fWeekdaysCount+1];
|
||||
/* test for NULL */
|
||||
|
@ -623,16 +614,11 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, UBoo
|
|||
}
|
||||
|
||||
ResourceBundle lsweekdaysData = resource.get(fgDayAbbreviationsTag, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
fShortWeekdaysCount = lsweekdaysData.getSize();
|
||||
fShortWeekdays = new UnicodeString[fShortWeekdaysCount+1];
|
||||
/* test for NULL */
|
||||
if (fShortWeekdays == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete [] fWeekdays;
|
||||
return;
|
||||
}
|
||||
fShortWeekdays[0] = UnicodeString();
|
||||
|
@ -640,12 +626,6 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, UBoo
|
|||
fShortWeekdays[i+1] = lsweekdaysData.getStringEx(i, status);
|
||||
}
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
delete [] fWeekdays;
|
||||
delete [] fShortWeekdays;
|
||||
return;
|
||||
}
|
||||
fWeekdaysCount = fShortWeekdaysCount = 8;
|
||||
|
||||
// If the locale data does not include new pattern chars, use the defaults
|
||||
|
|
|
@ -204,10 +204,6 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
|
|||
fNormalizedGregorianCutover(fGregorianCutover),
|
||||
fGregorianCutoverYear(1582)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
set(Calendar::ERA, AD);
|
||||
set(Calendar::YEAR, year);
|
||||
set(Calendar::MONTH, month);
|
||||
|
@ -223,10 +219,6 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
|
|||
fNormalizedGregorianCutover(fGregorianCutover),
|
||||
fGregorianCutoverYear(1582)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
set(Calendar::ERA, AD);
|
||||
set(Calendar::YEAR, year);
|
||||
set(Calendar::MONTH, month);
|
||||
|
@ -245,10 +237,6 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
|
|||
fNormalizedGregorianCutover(fGregorianCutover),
|
||||
fGregorianCutoverYear(1582)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
set(Calendar::ERA, AD);
|
||||
set(Calendar::YEAR, year);
|
||||
set(Calendar::MONTH, month);
|
||||
|
@ -655,10 +643,6 @@ GregorianCalendar::computeFields(UErrorCode& status)
|
|||
|
||||
// Time to fields takes the wall millis (Standard or DST).
|
||||
timeToFields(localMillis, FALSE, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t era = (uint8_t) internalGetEra();
|
||||
int32_t year = internalGet(YEAR);
|
||||
|
@ -698,10 +682,6 @@ GregorianCalendar::computeFields(UErrorCode& status)
|
|||
timeToFields(dstMillis, FALSE, status);
|
||||
}
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
// Fill in all time-related fields based on millisInDay. Call internalSet()
|
||||
// so as not to perturb flags.
|
||||
internalSet(MILLISECOND, millisInDay % 1000);
|
||||
|
@ -796,10 +776,6 @@ GregorianCalendar::boundsCheck(int32_t value, EDateFields field) const
|
|||
UDate
|
||||
GregorianCalendar::getEpochDay(UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0.0;
|
||||
}
|
||||
complete(status);
|
||||
// Divide by 1000 (convert to seconds) in order to prevent overflow when
|
||||
// dealing with UDate(Long.MIN_VALUE) and UDate(Long.MAX_VALUE).
|
||||
|
@ -974,10 +950,6 @@ GregorianCalendar::computeTime(UErrorCode& status)
|
|||
monthLength(internalGet(MONTH)),
|
||||
status) -
|
||||
zoneOffset;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
// Note: Because we pass in wall millisInDay, rather than
|
||||
// standard millisInDay, we interpret "1:00 am" on the day
|
||||
// of cessation of DST as "1:00 am Std" (assuming the time
|
||||
|
@ -1552,10 +1524,6 @@ GregorianCalendar::roll(EDateFields field, int32_t amount, UErrorCode& status)
|
|||
int32_t min = 0, max = 0, gap;
|
||||
if (field >= 0 && field < FIELD_COUNT) {
|
||||
complete(status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
min = getMinimum(field);
|
||||
max = getMaximum(field);
|
||||
}
|
||||
|
@ -1609,10 +1577,6 @@ GregorianCalendar::roll(EDateFields field, int32_t amount, UErrorCode& status)
|
|||
{
|
||||
// Assume min == 0 in calculations below
|
||||
UDate start = getTime(status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
int32_t oldHour = internalGet(field);
|
||||
int32_t newHour = (oldHour + amount) % (max + 1);
|
||||
if(newHour < 0)
|
||||
|
|
|
@ -777,10 +777,6 @@ MessageFormat::format( const UnicodeString& pattern,
|
|||
UnicodeString& result,
|
||||
UErrorCode& success)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(success)) {
|
||||
return result;
|
||||
}
|
||||
// {sfb} why does this use a local when so many other places use a static?
|
||||
MessageFormat *temp = new MessageFormat(pattern, success);
|
||||
/* test for NULL */
|
||||
|
@ -832,11 +828,6 @@ MessageFormat::format(const Formattable* arguments,
|
|||
int32_t recursionProtection,
|
||||
UErrorCode& success) const
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(success)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if(/*arguments == NULL ||*/ cnt < 0) {
|
||||
success = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return result;
|
||||
|
@ -871,10 +862,6 @@ MessageFormat::format(const Formattable* arguments,
|
|||
// refers to a ChoiceFormat object.
|
||||
if (fFormats[i] != NULL) {
|
||||
fFormats[i]->format(obj, arg, success);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(success)) {
|
||||
return result;
|
||||
}
|
||||
tryRecursion = (fFormats[i]->getDynamicClassID() == ChoiceFormat::getStaticClassID());
|
||||
}
|
||||
// If the obj data type if a number, use a NumberFormat instance.
|
||||
|
|
|
@ -185,10 +185,6 @@ NFRuleSet::parseRules(UnicodeString& description, const RuleBasedNumberFormat* o
|
|||
}
|
||||
currentDescription.setTo(description, oldP, p - oldP);
|
||||
NFRule::makeRules(currentDescription, this, rules.last(), owner, rules, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
oldP = p + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,10 +97,6 @@ NFRule::makeRules(UnicodeString& description,
|
|||
NFRuleList& rules,
|
||||
UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
// we know we're making at least one rule, so go ahead and
|
||||
// new it up and initialize its basevalue and divisor
|
||||
// (this also strips the rule descriptor, if any, off the
|
||||
|
@ -112,10 +108,6 @@ NFRule::makeRules(UnicodeString& description,
|
|||
return;
|
||||
}
|
||||
rule1->parseRuleDescriptor(description, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check the description to see whether there's text enclosed
|
||||
// in brackets
|
||||
|
@ -131,10 +123,6 @@ NFRule::makeRules(UnicodeString& description,
|
|||
|| rule1->getType() == kNegativeNumberRule) {
|
||||
rule1->ruleText = description;
|
||||
rule1->extractSubstitutions(ruleSet, predecessor, rbnf, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
rules.add(rule1);
|
||||
} else {
|
||||
// if the description does contain a matched pair of brackets,
|
||||
|
@ -196,10 +184,6 @@ NFRule::makeRules(UnicodeString& description,
|
|||
}
|
||||
rule2->ruleText.setTo(sbuf);
|
||||
rule2->extractSubstitutions(ruleSet, predecessor, rbnf, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// rule1's text includes the text in the brackets but omits
|
||||
|
@ -212,10 +196,6 @@ NFRule::makeRules(UnicodeString& description,
|
|||
}
|
||||
rule1->ruleText.setTo(sbuf);
|
||||
rule1->extractSubstitutions(ruleSet, predecessor, rbnf, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if we only have one rule, return it; if we have two, return
|
||||
// a two-element array containing them (notice that rule2 goes
|
||||
|
@ -244,10 +224,6 @@ NFRule::makeRules(UnicodeString& description,
|
|||
void
|
||||
NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
// the description consists of a rule descriptor and a rule body,
|
||||
// separated by a colon. The rule descriptor is optional. If
|
||||
// it's omitted, just set the base value to 0.
|
||||
|
@ -426,10 +402,6 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet,
|
|||
const RuleBasedNumberFormat* rbnf,
|
||||
UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
NFSubstitution* result = NULL;
|
||||
|
||||
// search the rule's rule text for the first two characters of
|
||||
|
@ -1165,12 +1137,6 @@ NFRule::prefixLength(const UnicodeString& str, const UnicodeString& prefix) cons
|
|||
// match collation elements between the strings
|
||||
int32_t oStr = strIter->next(err);
|
||||
int32_t oPrefix = prefixIter->next(err);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(err)) {
|
||||
delete prefixIter;
|
||||
delete strIter;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (oPrefix != CollationElementIterator::NULLORDER) {
|
||||
// skip over ignorable characters in the target string
|
||||
|
@ -1185,13 +1151,6 @@ NFRule::prefixLength(const UnicodeString& str, const UnicodeString& prefix) cons
|
|||
oPrefix = prefixIter->next(err);
|
||||
}
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(err)) {
|
||||
delete prefixIter;
|
||||
delete strIter;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// dlf: move this above following test, if we consume the
|
||||
// entire target, aren't we ok even if the source was also
|
||||
// entirely consumed?
|
||||
|
@ -1225,12 +1184,6 @@ NFRule::prefixLength(const UnicodeString& str, const UnicodeString& prefix) cons
|
|||
} else {
|
||||
oStr = strIter->next(err);
|
||||
oPrefix = prefixIter->next(err);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(err)) {
|
||||
delete prefixIter;
|
||||
delete strIter;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -452,10 +452,6 @@ NumberFormat::createInstance(const Locale& desiredLocale,
|
|||
}
|
||||
|
||||
ResourceBundle numberPatterns(resource.get(DecimalFormat::fgNumberPatterns, status));
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
}
|
||||
// If not all the styled patterns exists for the NumberFormat in this locale,
|
||||
// sets the status code to failure and returns nil.
|
||||
//if (patternCount < fgNumberPatternsCount) status = U_INVALID_FORMAT_ERROR;
|
||||
|
|
|
@ -43,11 +43,6 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
|
|||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
variableNames = new Hashtable(status);
|
||||
/* test for NULL*/
|
||||
if (variableNames == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
if (U_SUCCESS(status)) {
|
||||
variableNames->setValueDeleter(uhash_deleteUnicodeString);
|
||||
int32_t pos = -1;
|
||||
|
@ -55,16 +50,7 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
|
|||
while ((e = other.variableNames->nextElement(pos)) != 0) {
|
||||
UnicodeString* value =
|
||||
new UnicodeString(*(const UnicodeString*)e->value.pointer);
|
||||
/* test for NULL */
|
||||
if (value == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
variableNames->put(*(UnicodeString*)e->key.pointer, value, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,10 +156,6 @@ const char TransliterationRuleSet::fgClassID=0;
|
|||
* Construct a new empty rule set.
|
||||
*/
|
||||
TransliterationRuleSet::TransliterationRuleSet(UErrorCode& status) : UObject() {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
ruleVector = new UVector(&_deleteRule, NULL, status);
|
||||
rules = NULL;
|
||||
maxContextLength = 0;
|
||||
|
@ -237,10 +233,6 @@ void TransliterationRuleSet::addRule(TransliterationRule* adoptedRule,
|
|||
return;
|
||||
}
|
||||
ruleVector->addElement(adoptedRule, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t len;
|
||||
if ((len = adoptedRule->getContextLength()) > maxContextLength) {
|
||||
|
@ -319,10 +311,6 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
|
|||
}
|
||||
}
|
||||
}
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
uprv_free(indexValue);
|
||||
index[256] = v.size();
|
||||
|
||||
|
|
|
@ -168,10 +168,6 @@ void SimpleTimeZone::construct(int32_t rawOffsetGMT,
|
|||
int32_t savingsDST,
|
||||
UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
this->rawOffset = rawOffsetGMT;
|
||||
this->startMonth = savingsStartMonth;
|
||||
this->startDay = savingsStartDay;
|
||||
|
@ -319,10 +315,6 @@ void
|
|||
SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
|
||||
int32_t time, TimeMode mode, UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
startMonth = (int8_t)month;
|
||||
startDay = (int8_t)dayOfWeekInMonth;
|
||||
startDayOfWeek = (int8_t)dayOfWeek;
|
||||
|
@ -374,10 +366,6 @@ void
|
|||
SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
|
||||
int32_t time, TimeMode mode, UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
endMonth = (int8_t)month;
|
||||
endDay = (int8_t)dayOfWeekInMonth;
|
||||
endDayOfWeek = (int8_t)dayOfWeek;
|
||||
|
@ -421,10 +409,6 @@ int32_t
|
|||
SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
|
||||
uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
// Check the month before indexing into staticMonthLength. This
|
||||
// duplicates the test that occurs in the 7-argument getOffset(),
|
||||
// however, this is unavoidable. We don't mind because this method, in
|
||||
|
@ -444,10 +428,6 @@ int32_t
|
|||
SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
|
||||
uint8_t dayOfWeek, int32_t millis,
|
||||
int32_t monthLength, UErrorCode& status) const {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
// Check the month before indexing into staticMonthLength. This
|
||||
// duplicates a test that occurs in the 9-argument getOffset(),
|
||||
// however, this is unavoidable. We don't mind because this method, in
|
||||
|
@ -716,10 +696,6 @@ UBool SimpleTimeZone::inDaylightTime(UDate date, UErrorCode& status) const
|
|||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return FALSE;
|
||||
}
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return FALSE;
|
||||
}
|
||||
gc->setTime(date, status);
|
||||
UBool result = gc->inDaylightTime(status);
|
||||
delete gc;
|
||||
|
@ -827,10 +803,6 @@ SimpleTimeZone::hasSameRules(const TimeZone& other) const
|
|||
void
|
||||
SimpleTimeZone::decodeRules(UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
decodeStartRule(status);
|
||||
decodeEndRule(status);
|
||||
}
|
||||
|
|
|
@ -510,10 +510,6 @@ SimpleDateFormat::subFormat(UnicodeString& result,
|
|||
Calendar& cal,
|
||||
UErrorCode& status) const
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
}
|
||||
// this function gets called by format() to produce the appropriate substitution
|
||||
// text for an individual pattern symbol (e.g., "HH" or "yyyy")
|
||||
|
||||
|
@ -619,10 +615,6 @@ SimpleDateFormat::subFormat(UnicodeString& result,
|
|||
|
||||
value = cal.get(Calendar::ZONE_OFFSET, status) +
|
||||
cal.get(Calendar::DST_OFFSET, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (value < 0) {
|
||||
zoneString += fgGmtMinus;
|
||||
|
|
|
@ -214,10 +214,6 @@ StringSearch & StringSearch::operator=(const StringSearch &that)
|
|||
m_text_.length(),
|
||||
that.m_strsrch_->collator,
|
||||
NULL, &status);
|
||||
/* test for buffer overflows */
|
||||
if (U_SUCCESS(status)) {
|
||||
return *this;
|
||||
}
|
||||
int32_t length;
|
||||
const UChar *rules = ucol_getRules(m_strsrch_->collator, &length);
|
||||
m_collation_rules_.setTo(rules, length);
|
||||
|
@ -319,10 +315,6 @@ SearchIterator * StringSearch::safeClone(void) const
|
|||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
}
|
||||
result->setOffset(getOffset(), status);
|
||||
result->setMatchStart(m_strsrch_->search->matchedIndex);
|
||||
result->setMatchLength(m_strsrch_->search->matchedLength);
|
||||
|
@ -345,10 +337,6 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
|
|||
m_search_->matchedLength = 0;
|
||||
ucol_setOffset(m_strsrch_->textIter, m_search_->matchedIndex,
|
||||
&status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return USEARCH_DONE;
|
||||
}
|
||||
if (m_search_->matchedIndex == m_search_->textLength) {
|
||||
m_search_->matchedIndex = USEARCH_DONE;
|
||||
}
|
||||
|
@ -402,10 +390,6 @@ int32_t StringSearch::handlePrev(int32_t position, UErrorCode &status)
|
|||
m_search_->matchedIndex --;
|
||||
ucol_setOffset(m_strsrch_->textIter, m_search_->matchedIndex,
|
||||
&status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return USEARCH_DONE;
|
||||
}
|
||||
m_search_->matchedLength = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,10 +147,6 @@ RuleBasedCollator::construct(const UnicodeString& rules,
|
|||
UColAttributeValue decompositionMode,
|
||||
UErrorCode& status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
ucollator = ucol_openRules(rules.getBuffer(), rules.length(),
|
||||
decompositionMode, collationStrength,
|
||||
NULL, &status);
|
||||
|
|
|
@ -750,10 +750,6 @@ TimeZone::createCustomTimeZone(const UnicodeString& id)
|
|||
|
||||
UErrorCode success = U_ZERO_ERROR;
|
||||
numberFormat = NumberFormat::createInstance(success);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(success)) {
|
||||
return 0;
|
||||
}
|
||||
numberFormat->setParseIntegerOnly(TRUE);
|
||||
|
||||
|
||||
|
|
|
@ -101,10 +101,6 @@ void TitlecaseTransliterator::handleTransliterate(
|
|||
SKIP = new UnicodeSet(UNICODE_STRING_SIMPLE("[\\u00AD \\u2019 \\' [:Mn:] [:Me:] [:Cf:] [:Lm:] [:Sk:]]"), ec);
|
||||
CASED = new UnicodeSet(UNICODE_STRING_SIMPLE("[[:Lu:] [:Ll:] [:Lt:]]"), ec);
|
||||
ucln_i18n_registerCleanup();
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(ec)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -712,10 +712,6 @@ UnicodeString& Transliterator::getDisplayName(const UnicodeString& id,
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
ResourceBundle bundle(u_getDataDirectory(), inLocale, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Suspend checking status until later...
|
||||
|
||||
|
|
|
@ -84,11 +84,6 @@ TransliteratorAlias::~TransliteratorAlias() {
|
|||
|
||||
Transliterator* TransliteratorAlias::create(UParseError& pe,
|
||||
UErrorCode& ec) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(ec)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Transliterator *t;
|
||||
if (trans == 0) {
|
||||
t = Transliterator::createInstance(aliasID, UTRANS_FORWARD, pe, ec);
|
||||
|
@ -471,10 +466,6 @@ TransliteratorRegistry::TransliteratorRegistry(UErrorCode& status) :
|
|||
specDAG(TRUE),
|
||||
availableIDs(status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
registry.setValueDeleter(deleteEntry);
|
||||
availableIDs.setDeleter(uhash_deleteUnicodeString);
|
||||
availableIDs.setComparer(uhash_compareCaselessUnicodeString);
|
||||
|
@ -489,10 +480,6 @@ Transliterator* TransliteratorRegistry::get(const UnicodeString& ID,
|
|||
TransliteratorAlias*& aliasReturn,
|
||||
UParseError& parseError,
|
||||
UErrorCode& status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
Entry *entry = find(ID);
|
||||
return (entry == 0) ? 0
|
||||
: instantiateEntry(ID, entry, aliasReturn, parseError,status);
|
||||
|
@ -704,10 +691,6 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
|
|||
UBool visible) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
registry.put(ID, adopted, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
if (visible) {
|
||||
registerSTV(source, target, variant);
|
||||
if (!availableIDs.contains((void*) &ID)) {
|
||||
|
@ -739,10 +722,6 @@ void TransliteratorRegistry::registerSTV(const UnicodeString& source,
|
|||
}
|
||||
targets->setValueDeleter(uhash_deleteUVector);
|
||||
specDAG.put(source, targets, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
UVector *variants = (UVector*) targets->get(target);
|
||||
if (variants == 0) {
|
||||
|
@ -752,10 +731,6 @@ void TransliteratorRegistry::registerSTV(const UnicodeString& source,
|
|||
return;
|
||||
}
|
||||
targets->put(target, variants, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// assert(NO_VARIANT == "");
|
||||
// We add the variant string. If it is the special "no variant"
|
||||
|
|
|
@ -1364,10 +1364,6 @@ void collPrevIterNormalize(collIterate *data)
|
|||
|
||||
normLen = unorm_normalize(pStart, (pEnd - pStart) + 1, UNORM_NFD, 0,
|
||||
data->writableBuffer, 0, &status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->writableBufSize <= normLen) {
|
||||
freeHeapWritableBuffer(data);
|
||||
|
@ -1386,10 +1382,6 @@ void collPrevIterNormalize(collIterate *data)
|
|||
*(pStartNorm - 1) = 0;
|
||||
unorm_normalize(pStart, (pEnd - pStart) + 1, UNORM_NFD, 0, pStartNorm,
|
||||
normLen, &status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
data->pos = data->writableBuffer + data->writableBufSize;
|
||||
data->origFlags = data->flags;
|
||||
|
@ -1514,10 +1506,6 @@ static
|
|||
inline uint32_t ucol_IGetPrevCE(const UCollator *coll, collIterate *data,
|
||||
UErrorCode *status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t result = UCOL_NULLORDER;
|
||||
if (data->CEpos > data->CEs) {
|
||||
data->toReturn --;
|
||||
|
@ -1680,10 +1668,6 @@ ucol_getPrevCE(const UCollator *coll, collIterate *data,
|
|||
/* this should be connected to special Jamo handling */
|
||||
U_CAPI uint32_t U_EXPORT2
|
||||
ucol_getFirstCE(const UCollator *coll, UChar u, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
collIterate colIt;
|
||||
uint32_t order;
|
||||
IInit_collIterate(coll, &u, 1, &colIt);
|
||||
|
@ -1803,10 +1787,6 @@ inline void normalizeNextContraction(collIterate *data)
|
|||
|
||||
normLen = unorm_normalize(pStart, pEnd - pStart, UNORM_NFD, 0, buffer, 0,
|
||||
&status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (buffersize <= normLen + strsize) {
|
||||
uint32_t size = strsize + normLen + 1;
|
||||
|
@ -1823,10 +1803,6 @@ inline void normalizeNextContraction(collIterate *data)
|
|||
/* null-termination will be added here */
|
||||
unorm_normalize(pStart, pEnd - pStart, UNORM_NFD, 0, pStartNorm,
|
||||
normLen + 1, &status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
data->pos = data->writableBuffer + strsize;
|
||||
data->origFlags = data->flags;
|
||||
|
@ -2117,10 +2093,6 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
|
|||
collIterateState entryState;
|
||||
backupState(source, &entryState);
|
||||
UChar32 cp = ch;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
//UChar *entryPos = source->pos;
|
||||
for (;;) {
|
||||
// This loop will repeat only in the case of contractions, and only when a contraction
|
||||
|
@ -2660,10 +2632,6 @@ inline void normalizePrevContraction(collIterate *data)
|
|||
|
||||
normLen = unorm_normalize(pStart, pEnd - pStart, UNORM_NFD, 0, buffer, 0,
|
||||
&status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nulltermsize <= normLen) {
|
||||
uint32_t size = buffersize - nulltermsize + normLen + 1;
|
||||
|
@ -2685,10 +2653,6 @@ inline void normalizePrevContraction(collIterate *data)
|
|||
*(pStartNorm - 1) = 0;
|
||||
unorm_normalize(pStart, pEnd - pStart, UNORM_NFD, 0, pStartNorm, normLen,
|
||||
&status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
data->pos = data->writableBuffer + nulltermsize;
|
||||
data->origFlags = data->flags;
|
||||
|
@ -2819,10 +2783,6 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
|
|||
uint32_t *endCEBuffer;
|
||||
UChar *strbuffer;
|
||||
int32_t noChars = 0;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
|
@ -3036,10 +2996,6 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
|
|||
temp.flags &= ~UCOL_ITER_NORM;
|
||||
|
||||
CE = ucol_IGetNextCE(coll, &temp, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
endCEBuffer = source->CEs + UCOL_EXPAND_CE_BUFFER_SIZE;
|
||||
while (CE != UCOL_NO_MORE_CES) {
|
||||
*(source->CEpos ++) = CE;
|
||||
|
@ -3056,10 +3012,6 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
|
|||
return UCOL_NULLORDER;
|
||||
}
|
||||
CE = ucol_IGetNextCE(coll, &temp, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
freeHeapWritableBuffer(&temp);
|
||||
if (strbuffer != buffer) {
|
||||
|
@ -3242,10 +3194,6 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
|
|||
/* anyway */
|
||||
static
|
||||
uint8_t *reallocateBuffer(uint8_t **secondaries, uint8_t *secStart, uint8_t *second, uint32_t *secSize, uint32_t newSize, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
#ifdef UCOL_DEBUG
|
||||
fprintf(stderr, ".");
|
||||
#endif
|
||||
|
@ -3476,11 +3424,6 @@ int32_t ucol_getSortKeySize(const UCollator *coll, collIterate *s, int32_t curre
|
|||
|
||||
for(;;) {
|
||||
order = ucol_IGetNextCE(coll, s, &status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(order == UCOL_NO_MORE_CES) {
|
||||
break;
|
||||
}
|
||||
|
@ -3909,11 +3852,6 @@ ucol_calcSortKey(const UCollator *coll,
|
|||
for(i=prevBuffSize; i<minBufferSize; ++i) {
|
||||
|
||||
order = ucol_IGetNextCE(coll, &s, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(order == UCOL_NO_MORE_CES) {
|
||||
finished = TRUE;
|
||||
break;
|
||||
|
@ -4431,10 +4369,6 @@ ucol_calcSortKeySimpleTertiary(const UCollator *coll,
|
|||
for(i=prevBuffSize; i<minBufferSize; ++i) {
|
||||
|
||||
order = ucol_IGetNextCE(coll, &s, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(order == 0) {
|
||||
continue;
|
||||
|
@ -4848,10 +4782,6 @@ ucol_setVariableTop(UCollator *coll, const UChar *varTop, int32_t len, UErrorCod
|
|||
IInit_collIterate(coll, varTop, len, &s);
|
||||
|
||||
uint32_t CE = ucol_IGetNextCE(coll, &s, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* here we check if we have consumed all characters */
|
||||
/* you can put in either one character or a contraction */
|
||||
|
@ -4862,10 +4792,6 @@ ucol_setVariableTop(UCollator *coll, const UChar *varTop, int32_t len, UErrorCod
|
|||
}
|
||||
|
||||
uint32_t nextCE = ucol_IGetNextCE(coll, &s, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(isContinuation(nextCE) && (nextCE & UCOL_PRIMARYMASK) != 0) {
|
||||
*status = U_PRIMARY_TOO_LONG_ERROR;
|
||||
|
|
|
@ -233,10 +233,6 @@ U_CFUNC void ucol_inv_getGapPositions(UColTokenParser *src, UColTokListHeader *l
|
|||
uint32_t st = 0;
|
||||
uint32_t t1, t2;
|
||||
int32_t pos;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UColToken *tok = lh->first;
|
||||
uint32_t tokStrength = tok->strength;
|
||||
|
@ -365,10 +361,6 @@ U_CFUNC uint32_t ucol_getSimpleCEGenerator(ucolCEGenerator *g, UColToken *tok, u
|
|||
/* TODO: rename to enum names */
|
||||
uint32_t high, low, count=1;
|
||||
uint32_t maxByte = (strength == UCOL_TERTIARY)?0x3F:0xFF;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(strength == UCOL_SECONDARY) {
|
||||
low = UCOL_COMMON_TOP2<<24;
|
||||
|
@ -394,10 +386,6 @@ U_CFUNC uint32_t ucol_getSimpleCEGenerator(ucolCEGenerator *g, UColToken *tok, u
|
|||
}
|
||||
|
||||
U_CFUNC uint32_t ucol_getCEGenerator(ucolCEGenerator *g, uint32_t* lows, uint32_t* highs, UColToken *tok, uint32_t fStrength, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t strength = tok->strength;
|
||||
uint32_t low = lows[fStrength*3+strength];
|
||||
uint32_t high = highs[fStrength*3+strength];
|
||||
|
@ -503,10 +491,6 @@ U_CFUNC void ucol_doCE(uint32_t *CEparts, UColToken *tok) {
|
|||
}
|
||||
|
||||
U_CFUNC void ucol_initBuffers(UColTokenParser *src, UColTokListHeader *lh, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
ucolCEGenerator Gens[UCOL_CE_STRENGTH_LIMIT];
|
||||
uint32_t CEparts[UCOL_CE_STRENGTH_LIMIT];
|
||||
|
||||
|
@ -539,10 +523,6 @@ U_CFUNC void ucol_initBuffers(UColTokenParser *src, UColTokListHeader *lh, UErro
|
|||
|
||||
tok->toInsert = t[tok->strength];
|
||||
ucol_inv_getGapPositions(src, lh, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if UCOL_DEBUG
|
||||
fprintf(stderr, "BaseCE: %08X %08X\n", lh->baseCE, lh->baseContCE);
|
||||
|
|
|
@ -25,10 +25,6 @@
|
|||
U_NAMESPACE_BEGIN
|
||||
|
||||
void uprv_growTable(ContractionTable *tbl, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
if(tbl->position == tbl->size) {
|
||||
uint32_t *newData = (uint32_t *)uprv_realloc(tbl->CEs, 2*tbl->size*sizeof(uint32_t));
|
||||
if(newData == NULL) {
|
||||
|
@ -77,10 +73,6 @@ uprv_cnttab_open(UNewTrie *mapping, UErrorCode *status) {
|
|||
}
|
||||
|
||||
ContractionTable *addATableElement(CntTable *table, uint32_t *key, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
ContractionTable *el = (ContractionTable *)uprv_malloc(sizeof(ContractionTable));
|
||||
if(el == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -233,10 +225,6 @@ uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *sta
|
|||
}
|
||||
|
||||
ContractionTable *uprv_cnttab_cloneContraction(ContractionTable *t, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
ContractionTable *r = (ContractionTable *)uprv_malloc(sizeof(ContractionTable));
|
||||
if(r == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -290,10 +278,6 @@ uprv_cnttab_clone(CntTable *t, UErrorCode *status) {
|
|||
for(i = 0; i<t->size; i++) {
|
||||
r->elements[i] = uprv_cnttab_cloneContraction(t->elements[i], status);
|
||||
}
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(t->CEs != NULL) {
|
||||
r->CEs = (uint32_t *)uprv_malloc(t->position*sizeof(uint32_t));
|
||||
|
@ -386,10 +370,6 @@ uprv_cnttab_insertContraction(CntTable *table, uint32_t element, UChar codePoint
|
|||
|
||||
uprv_growTable(tbl, status);
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
|
@ -430,10 +410,6 @@ uprv_cnttab_addContraction(CntTable *table, uint32_t element, UChar codePoint, u
|
|||
|
||||
uprv_growTable(tbl, status);
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
tbl->CEs[tbl->position] = value;
|
||||
tbl->codePoints[tbl->position] = codePoint;
|
||||
|
||||
|
@ -456,10 +432,6 @@ uprv_cnttab_setContraction(CntTable *table, uint32_t element, uint32_t offset, U
|
|||
if((element == 0xFFFFFF) || (tbl = table->elements[element]) == NULL) {
|
||||
tbl = addATableElement(table, &element, status);
|
||||
}
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(offset >= tbl->size) {
|
||||
*status = U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
|
|
|
@ -126,10 +126,6 @@ uhash_freeBlockWrapper(void *obj) {
|
|||
|
||||
U_CAPI tempUCATable* U_EXPORT2
|
||||
uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollator *UCA, UColCETags initTag, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
tempUCATable *t = (tempUCATable *)uprv_malloc(sizeof(tempUCATable));
|
||||
/* test for NULL */
|
||||
if (t == NULL) {
|
||||
|
@ -170,17 +166,9 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
|
|||
/*t->mapping = ucmpe32_open(UCOL_SPECIAL_FLAG | (initTag<<24), UCOL_SPECIAL_FLAG | (SURROGATE_TAG<<24), UCOL_SPECIAL_FLAG | (LEAD_SURROGATE_TAG<<24), status);*/
|
||||
t->mapping = utrie_open(NULL, NULL, 0x100000, UCOL_SPECIAL_FLAG | (initTag<<24), TRUE); // Do your own mallocs for the structure, array and have linear Latin 1
|
||||
t->prefixLookup = uhash_open(prefixLookupHash, prefixLookupComp, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
uhash_setValueDeleter(t->prefixLookup, uhash_freeBlock);
|
||||
|
||||
t->contractions = uprv_cnttab_open(t->mapping, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* copy UCA's maxexpansion and merge as we go along */
|
||||
t->maxExpansions = maxet;
|
||||
|
@ -291,10 +279,6 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
|||
|
||||
if(t->contractions != NULL) {
|
||||
r->contractions = uprv_cnttab_clone(t->contractions, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
r->contractions->mapping = r->mapping;
|
||||
}
|
||||
|
||||
|
@ -437,10 +421,6 @@ int uprv_uca_setMaxExpansion(uint32_t endexpansion,
|
|||
MaxExpansionTable *maxexpansion,
|
||||
UErrorCode *status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
if (maxexpansion->size == 0) {
|
||||
/* we'll always make the first element 0, for easier manipulation */
|
||||
maxexpansion->endExpansionCE =
|
||||
|
@ -584,10 +564,6 @@ int uprv_uca_setMaxJamoExpansion(UChar ch,
|
|||
MaxJamoExpansionTable *maxexpansion,
|
||||
UErrorCode *status)
|
||||
{
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
UBool isV = TRUE;
|
||||
if (((uint32_t)ch - 0x1100) <= (0x1112 - 0x1100)) {
|
||||
/* determines L for Jamo, doesn't need to store this since it is never
|
||||
|
@ -745,10 +721,6 @@ uint32_t uprv_uca_addPrefix(tempUCATable *t, uint32_t CE,
|
|||
// long. Although this table could quite easily mimic complete contraction stuff
|
||||
// there is no good reason to make a general solution, as it would require some
|
||||
// error prone messing.
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
CntTable *contractions = t->contractions;
|
||||
UChar32 cp;
|
||||
uint32_t cpsize = 0;
|
||||
|
@ -880,10 +852,6 @@ uint32_t uprv_uca_addPrefix(tempUCATable *t, uint32_t CE,
|
|||
// would complicate code way too much.
|
||||
uint32_t uprv_uca_addContraction(tempUCATable *t, uint32_t CE,
|
||||
UCAElements *element, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
CntTable *contractions = t->contractions;
|
||||
UChar32 cp;
|
||||
uint32_t cpsize = 0;
|
||||
|
@ -974,10 +942,6 @@ static uint32_t uprv_uca_processContraction(CntTable *contractions, UCAElements
|
|||
return element->mapCE; /*can't do just that. existingCe might be a contraction, meaning that we need to do another step */
|
||||
}
|
||||
}
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return UCOL_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* this recursion currently feeds on the only element we have... We will have to copy it in order to accomodate */
|
||||
/* for both backward and forward cycles */
|
||||
|
@ -1012,10 +976,6 @@ static uint32_t uprv_uca_processContraction(CntTable *contractions, UCAElements
|
|||
}
|
||||
|
||||
static uint32_t uprv_uca_finalizeAddition(tempUCATable *t, UCAElements *element, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t CE = UCOL_NOT_FOUND;
|
||||
// This should add a completely ignorable element to the
|
||||
// unsafe table, so that backward iteration will skip
|
||||
|
@ -1141,10 +1101,6 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
|
|||
}
|
||||
}
|
||||
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
// here we want to add the prefix structure.
|
||||
// I will try to process it as a reverse contraction, if possible.
|
||||
// prefix buffer is already reversed.
|
||||
|
@ -1198,10 +1154,6 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
|
|||
if(element->cSize > 1 && !(element->cSize==2 && UTF16_IS_LEAD(element->cPoints[0]) && UTF16_IS_TRAIL(element->cPoints[1]))) { // this is a contraction, we should check whether a composed form should also be included
|
||||
UnicodeString source(element->cPoints, element->cSize);
|
||||
CanonicalIterator it(source, *status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
source = it.next();
|
||||
while(source.length() > 0) {
|
||||
if(Normalizer::quickCheck(source, UNORM_FCD, *status) != UNORM_NO) {
|
||||
|
@ -1234,20 +1186,12 @@ void uprv_uca_getMaxExpansionJamo(UNewTrie *mapping,
|
|||
uint32_t v = VBASE + VCOUNT - 1;
|
||||
uint32_t t = TBASE + TCOUNT - 1;
|
||||
uint32_t ce;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (v >= VBASE) {
|
||||
/*ce = ucmpe32_get(mapping, v);*/
|
||||
ce = utrie_get32(mapping, v, NULL);
|
||||
if (ce < UCOL_SPECIAL_FLAG) {
|
||||
uprv_uca_setMaxExpansion(ce, 2, maxexpansion, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
v --;
|
||||
}
|
||||
|
@ -1258,10 +1202,6 @@ void uprv_uca_getMaxExpansionJamo(UNewTrie *mapping,
|
|||
ce = utrie_get32(mapping, t, NULL);
|
||||
if (ce < UCOL_SPECIAL_FLAG) {
|
||||
uprv_uca_setMaxExpansion(ce, 3, maxexpansion, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
t --;
|
||||
}
|
||||
|
@ -1375,10 +1315,6 @@ uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status) {
|
|||
|
||||
// After setting the jamo expansions, compact the trie and get the needed size
|
||||
int32_t mappingSize = utrie_serialize(mapping, NULL, 0, getFoldedValue /*getFoldedValue*/, FALSE, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32_t tableOffset = 0;
|
||||
uint8_t *dataStart;
|
||||
|
@ -1460,10 +1396,6 @@ uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status) {
|
|||
|
||||
myData->mappingPosition = tableOffset;
|
||||
utrie_serialize(mapping, dataStart+tableOffset, toAllocate-tableOffset, getFoldedValue, FALSE, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
#ifdef UCOL_DEBUG
|
||||
// This is debug code to dump the contents of the trie. It needs two functions defined above
|
||||
{
|
||||
|
@ -1504,10 +1436,6 @@ uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status) {
|
|||
|
||||
/* Unsafe chars table. Finish it off, then copy it. */
|
||||
uprv_uca_unsafeCPAddCCNZ(t, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
if (t->UCA != 0) { /* Or in unsafebits from UCA, making a combined table. */
|
||||
for (i=0; i<UCOL_UNSAFECP_TABLE_SIZE; i++) {
|
||||
t->unsafeCP[i] |= t->UCA->unsafeCP[i];
|
||||
|
|
|
@ -639,10 +639,6 @@ ucol_tok_parseNextToken(UColTokenParser *src,
|
|||
UParseError *parseError,
|
||||
UErrorCode *status) {
|
||||
/* parsing part */
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
UBool variableTop = FALSE;
|
||||
UBool top = FALSE;
|
||||
UBool inChars = TRUE;
|
||||
|
@ -1011,11 +1007,6 @@ Processing Description
|
|||
|
||||
static UColToken *ucol_tok_initAReset(UColTokenParser *src, UChar *expand, uint32_t *expandNext,
|
||||
UParseError *parseError, UErrorCode *status) {
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(src->resultLen == src->listCapacity) {
|
||||
// Unfortunately, this won't work, as we store addresses of lhs in token
|
||||
src->listCapacity *= 2;
|
||||
|
@ -1109,10 +1100,6 @@ inline UColToken *getVirginBefore(UColTokenParser *src, UColToken *sourceToken,
|
|||
|
||||
baseCE = ucol_getNextCE(src->UCA, &s, status) & 0xFFFFFF3F;
|
||||
baseContCE = ucol_getNextCE(src->UCA, &s, status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
if(baseContCE == UCOL_NO_MORE_CES) {
|
||||
baseContCE = 0;
|
||||
}
|
||||
|
@ -1182,10 +1169,6 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
|
|||
UBool variableTop = FALSE;
|
||||
UBool top = FALSE;
|
||||
uint16_t specs = 0;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
UColTokListHeader *ListList = NULL;
|
||||
|
||||
src->parsedToken.strength = UCOL_TOK_UNSET;
|
||||
|
|
|
@ -38,21 +38,12 @@ u_formatMessage(const char *locale,
|
|||
...)
|
||||
{
|
||||
va_list ap;
|
||||
int32_t actLen;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
int32_t actLen;
|
||||
//argument checking defered to subsequent method calls
|
||||
|
||||
// start vararg processing
|
||||
va_start(ap, status);
|
||||
|
||||
actLen = u_vformatMessage(locale,pattern,patternLength,result,resultLength,ap,status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
// end vararg processing
|
||||
va_end(ap);
|
||||
|
||||
|
@ -70,10 +61,6 @@ u_vformatMessage( const char *locale,
|
|||
|
||||
{
|
||||
//argument checking defered to subsequent method calls
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
UMessageFormat *fmt = umsg_open(pattern,patternLength,locale,NULL,status);
|
||||
int32_t retVal = umsg_vformat(fmt,result,resultLength,ap,status);
|
||||
umsg_close(fmt);
|
||||
|
@ -93,21 +80,13 @@ u_formatMessageWithError(const char *locale,
|
|||
va_list ap;
|
||||
int32_t actLen;
|
||||
//argument checking defered to subsequent method calls
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
// start vararg processing
|
||||
va_start(ap, status);
|
||||
|
||||
actLen = u_vformatMessageWithError(locale,pattern,patternLength,result,resultLength,parseError,ap,status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// end vararg processing
|
||||
va_end(ap);
|
||||
|
||||
return actLen;
|
||||
}
|
||||
|
||||
|
@ -123,10 +102,6 @@ u_vformatMessageWithError( const char *locale,
|
|||
|
||||
{
|
||||
//argument checking defered to subsequent method calls
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
UMessageFormat *fmt = umsg_open(pattern,patternLength,locale,parseError,status);
|
||||
int32_t retVal = umsg_vformat(fmt,result,resultLength,ap,status);
|
||||
umsg_close(fmt);
|
||||
|
@ -148,20 +123,12 @@ u_parseMessage( const char *locale,
|
|||
...)
|
||||
{
|
||||
va_list ap;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
//argument checking defered to subsequent method calls
|
||||
|
||||
// start vararg processing
|
||||
va_start(ap, status);
|
||||
|
||||
u_vparseMessage(locale,pattern,patternLength,source,sourceLength,ap,status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
// end vararg processing
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -176,10 +143,6 @@ u_vparseMessage(const char *locale,
|
|||
UErrorCode *status)
|
||||
{
|
||||
//argument checking defered to subsequent method calls
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
UMessageFormat *fmt = umsg_open(pattern,patternLength,locale,NULL,status);
|
||||
int32_t count = 0;
|
||||
umsg_vparse(fmt,source,sourceLength,&count,ap,status);
|
||||
|
@ -199,19 +162,11 @@ u_parseMessageWithError(const char *locale,
|
|||
va_list ap;
|
||||
|
||||
//argument checking defered to subsequent method calls
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// start vararg processing
|
||||
va_start(ap, status);
|
||||
|
||||
u_vparseMessageWithError(locale,pattern,patternLength,source,sourceLength,ap,error,status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
// end vararg processing
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -226,10 +181,6 @@ u_vparseMessageWithError(const char *locale,
|
|||
UErrorCode* status)
|
||||
{
|
||||
//argument checking defered to subsequent method calls
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
UMessageFormat *fmt = umsg_open(pattern,patternLength,locale,error,status);
|
||||
int32_t count = 0;
|
||||
umsg_vparse(fmt,source,sourceLength,&count,ap,status);
|
||||
|
@ -387,11 +338,7 @@ umsg_format( UMessageFormat *fmt,
|
|||
...)
|
||||
{
|
||||
va_list ap;
|
||||
int32_t actLen;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
int32_t actLen;
|
||||
//argument checking defered to last method call umsg_vformat which
|
||||
//saves time when arguments are valid and we dont care when arguments are not
|
||||
//since we return an error anyway
|
||||
|
@ -494,10 +441,6 @@ umsg_parse( UMessageFormat *fmt,
|
|||
...)
|
||||
{
|
||||
va_list ap;
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
//argument checking defered to last method call umsg_vparse which
|
||||
//saves time when arguments are valid and we dont care when arguments are not
|
||||
//since we return an error anyway
|
||||
|
@ -534,10 +477,6 @@ umsg_vparse(UMessageFormat *fmt,
|
|||
|
||||
UnicodeString srcString(source,sourceLength);
|
||||
Formattable *args = ((MessageFormat*)fmt)->parse(source,*count,*status);
|
||||
/* test for buffer overflows */
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
UDate *aDate;
|
||||
double *aDouble;
|
||||
UChar *aString;
|
||||
|
|
Loading…
Add table
Reference in a new issue