From f71487da3a93ec5f52af496301d91e5b8777494d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Tue, 6 Mar 2012 13:34:30 +0100 Subject: Fix crash in QVariant::canConvert. The function was crashing when an unsupported type id was given as an input argument. Change-Id: I2b0e3e6d43f6f248dc71532f8e6485efe68e8120 Reviewed-by: Stephen Kelly --- src/corelib/kernel/qvariant.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 029a261faf..c8456192ed 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2445,6 +2445,8 @@ bool QVariant::canConvert(int targetTypeId) const if (currentType == uint(targetTypeId)) return true; + if (targetTypeId < 0 || targetTypeId >= QMetaType::User) + return false; // FIXME It should be LastCoreType intead of Uuid if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) { -- cgit v1.2.3