From d4c8509a8379e65edcb2854ce7c527ed048e2ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 27 Mar 2012 15:26:19 +0200 Subject: [PATCH] Fail when no translations found, reset pointers on failure We don't want to be using or trusting partial loads. Change-Id: I3934d6cf54cd99eaab2fa7aee9a0e9968d9f3c13 Reviewed-by: Oswald Buddenhagen --- src/corelib/kernel/qtranslator.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 5ecaa280b3..02cd85f533 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -713,6 +713,20 @@ bool QTranslatorPrivate::do_load(const uchar *data, int len) data += blockLen; } + if (!offsetArray || !messageArray) + ok = false; + + if (!ok) { + messageArray = 0; + contextArray = 0; + offsetArray = 0; + numerusRulesArray = 0; + messageLength = 0; + contextLength = 0; + offsetLength = 0; + numerusRulesLength = 0; + } + return ok; }