Bug 1308606 - Crash in mozilla::safebrowsing::Classifier::UpdateHashStore. r?francois draft
authorDimi Lee <dlee@mozilla.com>
Sat, 08 Oct 2016 20:42:43 +0800
changeset 422752 45268889ba0b872387ed12d0cf4d1b81140e7321
parent 422670 a835589ae0c63a2d91be150d80b5fc600e44b447
child 533338 ea124d3ba7da6c39abe782ffdabb63debc91a741
push id31774
push userdlee@mozilla.com
push dateSat, 08 Oct 2016 12:43:07 +0000
reviewersfrancois
bugs1308606
milestone52.0a1
Bug 1308606 - Crash in mozilla::safebrowsing::Classifier::UpdateHashStore. r?francois MozReview-Commit-ID: FIl5cPFzGbl
toolkit/components/url-classifier/LookupCache.h
--- a/toolkit/components/url-classifier/LookupCache.h
+++ b/toolkit/components/url-classifier/LookupCache.h
@@ -123,17 +123,17 @@ public:
   virtual nsresult Open();
   virtual nsresult Init() = 0;
   virtual nsresult ClearPrefixes() = 0;
   virtual nsresult Has(const Completion& aCompletion,
                        bool* aHas, bool* aComplete) = 0;
 
   template<typename T>
   static T* Cast(LookupCache* aThat) {
-    return (T::VER == aThat->Ver() ? reinterpret_cast<T*>(aThat) : nullptr);
+    return ((aThat && T::VER == aThat->Ver()) ? reinterpret_cast<T*>(aThat) : nullptr);
   }
 
 private:
   nsresult Reset();
   nsresult LoadPrefixSet();
 
   virtual nsresult StoreToFile(nsIFile* aFile) = 0;
   virtual nsresult LoadFromFile(nsIFile* aFile) = 0;