summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@nokia.com>2012-03-08 15:36:38 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-08 16:04:02 +0100
commitcf6dd5baca26c202de26c8366010a8958ea08d20 (patch)
tree53f2fba4679174824c44ca0724015529895d4d40 /src
parentf71487da3a93ec5f52af496301d91e5b8777494d (diff)
Crash fix in QMetaType::typeName.
The function is public, so it should validate input instead of crashing Change-Id: Ifd9f1110f8631f942929d85db6a57eee7afffb6a Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qmetatype.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 410a5cc712..0be813f4f2 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -377,8 +377,9 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp,
\sa type(), isRegistered(), Type
*/
-const char *QMetaType::typeName(int type)
+const char *QMetaType::typeName(int typeId)
{
+ const uint type = typeId;
// In theory it can be filled during compilation time, but for some reason template code
// that is able to do it causes GCC 4.6 to generate additional 3K of executable code. Probably
// it is not worth of it.
@@ -400,7 +401,7 @@ const char *QMetaType::typeName(int type)
} else {
const QVector<QCustomTypeInfo> * const ct = customTypes();
QReadLocker locker(customTypesLock());
- return ct && ct->count() > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty()
+ return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty()
? ct->at(type - QMetaType::User).typeName.constData()
: 0;
}