-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 64bcd93. rdar://117463447
jsc_fuz/wktr: heap-use-after-free in WebCore::IDBServer::MemoryObjectStore::takeIndexByIdentifier(unsigned long long) MemoryObjectStore.cpp:128. https://bugs.webkit.org/show_bug.cgi?id=264180. rdar://117463447. Reviewed by Sihui Liu. MemoryIndex now keeps WeakPtr to MemoryObjectStore 'm_objectStore' and checks it's validity before using it. Also RefPtr conversion from WekPtr using get() API as applicable. * LayoutTests/storage/indexeddb/abort-index-rename-crash-expected.txt: Added the test expected file. * LayoutTests/storage/indexeddb/abort-index-rename-crash.html: Added the test case. * Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp: Checks the validity of MemoryObjectStore pointer before using. (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreDeleted): (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed): (WebCore::IDBServer::MemoryBackingStoreTransaction::abort): * Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp: Changed direct reference to WeakPtr. Also used RefPtr conversion using get() API as applicable. (WebCore::IDBServer::MemoryIndex::objectStoreCleared): (WebCore::IDBServer::MemoryIndex::clearIndexValueStore): (WebCore::IDBServer::MemoryIndex::replaceIndexValueStore): (WebCore::IDBServer::MemoryIndex::getResultForKeyRange const): (WebCore::IDBServer::MemoryIndex::getAllRecords const): * Source/WebCore/Modules/indexeddb/server/MemoryIndex.h: Changed direct reference to WeakPtr. (WebCore::IDBServer::MemoryIndex::objectStore): * Source/WebCore/Modules/indexeddb/server/MemoryIndexCursor.cpp: Used RefPtr conversion using get() API for MemoryIndex based MemoryObjectStore object. (WebCore::IDBServer::MemoryIndexCursor::currentData): * Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h: Canonical link: https://commits.webkit.org/267815.545@safari-7617-branch
- Loading branch information
Showing
7 changed files
with
55 additions
and
26 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
LayoutTests/storage/indexeddb/abort-index-rename-crash-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This test passes if it doesn't crash. |
27 changes: 27 additions & 0 deletions
27
LayoutTests/storage/indexeddb/abort-index-rename-crash.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- webkit-test-runner [ useEphemeralSession=true ] --> | ||
<body> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
} | ||
indexedDB.open('abort-index-rename').onupgradeneeded = (event) => { | ||
request = event.target; | ||
transaction = request.transaction; | ||
transaction.onabort = () => { | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
database = request.result; | ||
objectStore = database.createObjectStore('os'); | ||
index = objectStore.createIndex('foo', 'foo'); | ||
index.name = 'bar'; | ||
database.deleteObjectStore('os'); | ||
objectStore2 = database.createObjectStore('os2'); | ||
objectStore2.add('value', 'key').onsuccess = () => { | ||
transaction.abort(); | ||
} | ||
}; | ||
</script> | ||
<p>This test passes if it doesn't crash.</p> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters