summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-06-04 10:37:59 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-06-05 18:57:31 +0000
commit458d49861f5ab04490014f7839be0dab30c8ac61 (patch)
tree7ef026fd703ea76adaa96ffd6f4a3b14730b2239 /src/corelib
parenta389001710770f0b7369790aa5f827137d304cd7 (diff)
Fix check for malformed input when decoding translations
Any integer modulo 1 can never be anything else but 0, so the statement could never be true. The intention is to abort in case of an odd number of bytes, as this would indicate malformed input that can't be decoded into a QString. Note that QTranslator will then silently continue to search for valid translations, and not print any error message at runtime, or otherwise inform the user or developer that an input message file contains malformed content. Change-Id: I957b337ee035f3aca013e0859f8ee70553d9a97b Coverity-Id: 11014 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qtranslator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index a9db17c749..844df2275d 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -911,7 +911,7 @@ static QString getMessage(const uchar *m, const uchar *end, const char *context,
goto end;
case Tag_Translation: {
int len = read32(m);
- if (len % 1)
+ if (len & 1)
return QString();
m += 4;
if (!numerus--) {