summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2021-02-17 16:12:48 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-19 09:21:32 +0000
commitcd950077b808e78d18af8c18c4e26769191ccf33 (patch)
treec5b2c5b432c7a3796446d04fc6ea71a078148707
parentdd5b8c842c1df7c68861505d762ee388925a36a0 (diff)
downloadqttools-cd950077b808e78d18af8c18c4e26769191ccf33.tar.gz
Fix check for malformed input when decoding translations
Use patch 458d49861f5 in qtbase also for the matching functionality in qttools. Any integer modulo 1 can never be anything else but 0, so the statement could never be true. Found by static analyzer: https://www.viva64.com/en/amp/b/0801/ Change-Id: I92d13877e5e44bb7555be7fb89c1ee546b25fbba Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit b96fe95da00aca6be4a30f7d6216f41e6538ec28) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/linguist/shared/qm.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/linguist/shared/qm.cpp b/src/linguist/shared/qm.cpp
index c13571702..71e2a832d 100644
--- a/src/linguist/shared/qm.cpp
+++ b/src/linguist/shared/qm.cpp
@@ -552,7 +552,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
goto end;
case Tag_Translation: {
int len = read32(m);
- if (len % 1) {
+ if (len & 1) {
cd.appendError(QLatin1String("QM-Format error"));
return false;
}