From 8636ee44675a14f4adf0368f588902cfdc37db2f Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Thu, 20 Oct 2011 10:48:11 -0400 Subject: [PATCH] Bug 695965: Fix use of uninitialized memory in nsUrlClassifierDBService::CheckClean. r=bent --- toolkit/components/url-classifier/nsUrlClassifierDBService.cpp | 2 +- toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 0270a6acdab..860093fca19 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -1430,7 +1430,7 @@ nsUrlClassifierDBService::CheckClean(const nsACString &spec, rv = KeyedHash(fragkey, hostprefix, prefixkey, &codedkey); NS_ENSURE_SUCCESS(rv, rv); - bool found; + bool found = false; bool ready = false; /* opportunistic probe */ rv = mPrefixSet->Probe(codedkey, prefixkey, &ready, &found); NS_ENSURE_SUCCESS(rv, rv); diff --git a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp index d7a15eea8d5..0196ac76054 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp @@ -278,6 +278,8 @@ nsUrlClassifierPrefixSet::Probe(PRUint32 aPrefix, PRUint32 aKey, { MutexAutoLock lock(mPrefixSetLock); + *aFound = false; + // We might have raced here with a LoadPrefixSet call, // loading a saved PrefixSet with another key than the one used to probe us. // This must occur exactly between the GetKey call and the Probe call.