summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2014-01-06 14:37:06 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-11 20:45:22 +0100
commit46de0c476589cdc5ba02cb4c439cb4f4b3ba401f (patch)
treea9b879ef6eb895bcca174df581be5ddd4990fccd /src
parentf2f2e4e53ee679b50878c042ecd64a0cf30c9569 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qlocale_win.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index 3a083582c9..c20827a4ae 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -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,