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>
This commit is contained in:
parent
a389001710
commit
458d49861f
@ -911,7 +911,7 @@ static QString getMessage(const uchar *m, const uchar *end, const char *context,
|
|||||||
goto end;
|
goto end;
|
||||||
case Tag_Translation: {
|
case Tag_Translation: {
|
||||||
int len = read32(m);
|
int len = read32(m);
|
||||||
if (len % 1)
|
if (len & 1)
|
||||||
return QString();
|
return QString();
|
||||||
m += 4;
|
m += 4;
|
||||||
if (!numerus--) {
|
if (!numerus--) {
|
||||||
|
Loading…
Reference in New Issue
Block a user