ICU-12570 remove undefined behaviors from cintltst. Mostly signed integer overflow.
X-SVN-Rev: 39042
This commit is contained in:
parent
d88a4109a5
commit
6083d859ba
@ -344,7 +344,7 @@ packDiff(int32_t diff) {
|
||||
} while(--count>0);
|
||||
|
||||
/* add lead byte */
|
||||
result|=(lead+diff)<<shift;
|
||||
result |= (uint32_t)(lead+diff)<<shift;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -666,12 +666,12 @@ void TestCheckFCD()
|
||||
UChar nfd[100];
|
||||
int normsize = 0;
|
||||
int nfdsize = 0;
|
||||
|
||||
|
||||
while (size != 19) {
|
||||
data[size] = datachar[(rand() * 50) / RAND_MAX];
|
||||
data[size] = datachar[rand() % UPRV_LENGTHOF(datachar)];
|
||||
log_verbose("0x%x", data[size]);
|
||||
normsize += unorm_normalize(data + size, 1, UNORM_NFD, 0,
|
||||
norm + normsize, 100 - normsize, &status);
|
||||
normsize += unorm_normalize(data + size, 1, UNORM_NFD, 0,
|
||||
norm + normsize, 100 - normsize, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
log_data_err("unorm_quickCheck(FCD) failed: exception occured at data generation - (Are you missing data?)\n");
|
||||
break;
|
||||
@ -680,8 +680,8 @@ void TestCheckFCD()
|
||||
}
|
||||
log_verbose("\n");
|
||||
|
||||
nfdsize = unorm_normalize(data, size, UNORM_NFD, 0,
|
||||
nfd, 100, &status);
|
||||
nfdsize = unorm_normalize(data, size, UNORM_NFD, 0,
|
||||
nfd, 100, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
log_data_err("unorm_quickCheck(FCD) failed: exception occured at normalized data generation - (Are you missing data?)\n");
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ SortTest() {
|
||||
|
||||
/* for medium, add bits that will not be compared, to test stability */
|
||||
for(i=0; i<UPRV_LENGTHOF(medium); ++i) {
|
||||
medium[i]=(medium[i]<<4)|i;
|
||||
medium[i]=(int32_t)((uint32_t)medium[i]<<4) | i;
|
||||
}
|
||||
|
||||
/* sort medium array (stable) */
|
||||
|
@ -65,7 +65,7 @@ static int64_t ranMax;
|
||||
|
||||
static void initRandom(int64_t min, int64_t max)
|
||||
{
|
||||
uint64_t interval = max - min;
|
||||
uint64_t interval = (uint64_t)max - (uint64_t)min;
|
||||
|
||||
ranMin = min;
|
||||
ranMax = max;
|
||||
|
Loading…
Reference in New Issue
Block a user