ICU-7550 udat_setSymbols should call verifyIsSimpleDateFormat to avoid crash with RelativeDateFormat
X-SVN-Rev: 28057
This commit is contained in:
parent
d3172c2d68
commit
d83f32e641
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2009, International Business Machines
|
||||
* Copyright (C) 1996-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -783,7 +783,7 @@ udat_setSymbols( UDateFormat *format,
|
||||
int32_t valueLength,
|
||||
UErrorCode *status)
|
||||
{
|
||||
|
||||
verifyIsSimpleDateFormat(format, status);
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
DateFormatSymbols *syms = (DateFormatSymbols *)((SimpleDateFormat *)format)->getDateFormatSymbols();
|
||||
|
@ -1201,6 +1201,18 @@ static void TestRelativeCrash(void) {
|
||||
log_err("FAIL: didn't crash on %s, but got success %s instead of %s. \n", what, u_errorName(subStatus), u_errorName(expectStatus));
|
||||
}
|
||||
}
|
||||
{
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
UChar symbolValue = 0x0041;
|
||||
what = "udat_setSymbols";
|
||||
log_verbose("Trying %s on a relative date..\n", what);
|
||||
udat_setSymbols(icudf, UDAT_ERAS,0,&symbolValue,1, &subStatus); /* bogus values */
|
||||
if(subStatus == expectStatus) {
|
||||
log_verbose("Success: did not crash on %s, but got %s.\n", what, u_errorName(subStatus));
|
||||
} else {
|
||||
log_err("FAIL: didn't crash on %s, but got success %s instead of %s. \n", what, u_errorName(subStatus), u_errorName(expectStatus));
|
||||
}
|
||||
}
|
||||
{
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
what = "udat_countSymbols";
|
||||
|
Loading…
Reference in New Issue
Block a user