summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2012-01-24 10:06:49 -0800
committerRussell Brenner <russellbrenner@google.com>2012-01-24 10:17:41 -0800
commit859c01f9680c58ddff5938862087b41478acd0a0 (patch)
treec628ab51cca6e550a9dfb0e19d2978588ee5375e
parent541839a11103a72d486edaab8a5c9e9499554511 (diff)
downloadexternal_webkit-859c01f9680c58ddff5938862087b41478acd0a0.zip
external_webkit-859c01f9680c58ddff5938862087b41478acd0a0.tar.gz
external_webkit-859c01f9680c58ddff5938862087b41478acd0a0.tar.bz2
Fix uninitialized return value for decoding
WebCore::TextEncoding::decode() has a return flag, passed by reference, which is set only upon failure, remaining uninitialized upon success. The flag is now initted to false by the caller. If it then changes to true, it indicates an actual failure, so we exit early. Change-Id: Ie4655349b8e44d92e8d7cc7531a6bcc077efbb34
-rw-r--r--Source/WebKit/android/jni/WebHistory.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/WebKit/android/jni/WebHistory.cpp b/Source/WebKit/android/jni/WebHistory.cpp
index 9bb29e3..1ab8f37 100644
--- a/Source/WebKit/android/jni/WebHistory.cpp
+++ b/Source/WebKit/android/jni/WebHistory.cpp
@@ -607,16 +607,14 @@ bool readString(const char*& data, const char* end, String& result, const char*
end, data, stringLength);
}
- bool decodeFailed;
+ bool decodeFailed = false;
static const WebCore::TextEncoding& encoding = WebCore::UTF8Encoding();
result = encoding.decode(data, stringLength, true, decodeFailed);
if (decodeFailed) {
ALOGW("Decode failed, tag=\"%s\" end=%p data=%p stringLength=%u content=\"%s\"",
dbgLabel ? dbgLabel : "<no tag>", end, data, stringLength,
result.utf8().data());
- // Although an error was reported, the previous implementation did not
- // stop here, and debug output of the result, which looks correct, makes
- // it unclear just what the error was.
+ return false;
}
if (stringLength > MAX_REASONABLE_STRING_LENGTH) {