QLocale - Check day number is valid

Check day number falls in valid range before using as array index.

Change-Id: I8d7c203b97988633fe4c345d5e7002bba9c2c68b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
John Layt 2014-01-06 14:37:06 +01:00 committed by The Qt Project
parent f2f2e4e53e
commit 46de0c4765
1 changed files with 3 additions and 0 deletions

View File

@ -279,6 +279,9 @@ QVariant QSystemLocalePrivate::dateTimeFormat(QLocale::FormatType type)
QVariant QSystemLocalePrivate::dayName(int day, QLocale::FormatType type)
{
if (day < 1 || day > 7)
return QString();
static const LCTYPE short_day_map[]
= { LOCALE_SABBREVDAYNAME1, LOCALE_SABBREVDAYNAME2,
LOCALE_SABBREVDAYNAME3, LOCALE_SABBREVDAYNAME4, LOCALE_SABBREVDAYNAME5,