Title: [133043] branches/chromium/1312/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp
Revision
133043
Author
jsb...@chromium.org
Date
2012-10-31 10:21:36 -0700 (Wed, 31 Oct 2012)

Log Message

Merge 132848 - IndexedDB: Crash on checking version of corrupt backing store
https://bugs.webkit.org/show_bug.cgi?id=100692

Reviewed by Tony Chang.

If the backing store fails to open (due to corruption, non-writeable disk, etc)
the subsequent schema version check dereferences a null pointer. Fix to only
do the schema check if the database opened.

Chromium tests will be included with crrev.com/11196029

* Modules/indexeddb/IDBLevelDBBackingStore.cpp:
(WebCore::IDBLevelDBBackingStore::open):


TBR=jsb...@chromium.org
Review URL: https://codereview.chromium.org/11358013

Modified Paths

Diff

Modified: branches/chromium/1312/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp (133042 => 133043)


--- branches/chromium/1312/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp	2012-10-31 17:07:31 UTC (rev 133042)
+++ branches/chromium/1312/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp	2012-10-31 17:21:36 UTC (rev 133043)
@@ -295,13 +295,13 @@
         String path = pathByAppendingComponent(pathBase, securityOrigin->databaseIdentifier() + ".indexeddb.leveldb");
 
         db = LevelDBDatabase::open(path, comparator.get());
-        bool knownSchema = isSchemaKnown(db.get());
-        if (!knownSchema) {
+        if (db && !isSchemaKnown(db.get())) {
             LOG_ERROR("IndexedDB backing store had unknown schema, treating it as failure to open");
             HistogramSupport::histogramEnumeration("WebCore.IndexedDB.BackingStore.OpenStatus", IDBLevelDBBackingStoreOpenFailedUnknownSchema, IDBLevelDBBackingStoreOpenMax);
+            db.release();
         }
 
-        if (db && knownSchema)
+        if (db)
             HistogramSupport::histogramEnumeration("WebCore.IndexedDB.BackingStore.OpenStatus", IDBLevelDBBackingStoreOpenSuccess, IDBLevelDBBackingStoreOpenMax);
         else {
             LOG_ERROR("IndexedDB backing store open failed, attempting cleanup");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to