From 2767210585916bc5b9c94701ad736ca07eb6d067 Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Thu, 21 Mar 2019 13:14:53 +0200 Subject: Fix update with long version numbers Update fails if version number is longer than 32bit int. Fixed so that the value is converted to 64bit int instead so the int overflow will not happen. Change-Id: If7ab57e89b155793e9fab3ba5dad9c734adc2234 Fixes: QTIFW-1310 Reviewed-by: Konstantin Podsvirov Reviewed-by: Samuli Piippo --- src/libs/kdtools/updatefinder.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/libs/kdtools/updatefinder.cpp b/src/libs/kdtools/updatefinder.cpp index b64f922c3..b12ffac99 100644 --- a/src/libs/kdtools/updatefinder.cpp +++ b/src/libs/kdtools/updatefinder.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB) -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -601,18 +601,18 @@ int KDUpdater::compareVersion(const QString &v1, const QString &v2) bool v2_ok = false; if (index == v1_comps.count() && index < v2_comps.count()) { - v2_comps.at(index).toInt(&v2_ok); + v2_comps.at(index).toLongLong(&v2_ok); return v2_ok ? -1 : +1; } if (index < v1_comps.count() && index == v2_comps.count()) { - v1_comps.at(index).toInt(&v1_ok); + v1_comps.at(index).toLongLong(&v1_ok); return v1_ok ? +1 : -1; } if (index >= v1_comps.count() || index >= v2_comps.count()) break; - int v1_comp = v1_comps.at(index).toInt(&v1_ok); - int v2_comp = v2_comps.at(index).toInt(&v2_ok); + qlonglong v1_comp = v1_comps.at(index).toLongLong(&v1_ok); + qlonglong v2_comp = v2_comps.at(index).toLongLong(&v2_ok); if (!v1_ok) { if (v1_comps.at(index) == QLatin1String("x")) -- cgit v1.2.3