RESOLVED FIXED 52890
IndexedDB corrupts data on disk
https://bugs.webkit.org/show_bug.cgi?id=52890
Summary IndexedDB corrupts data on disk
Andrei Popescu
Reported 2011-01-21 07:03:16 PST
IndexedDB corrupts data on disk
Attachments
Patch (16.27 KB, patch)
2011-01-21 07:20 PST, Andrei Popescu
no flags
Patch (16.38 KB, patch)
2011-01-21 09:39 PST, Andrei Popescu
jorlow: review+
Andrei Popescu
Comment 1 2011-01-21 07:11:13 PST
SerializedScriptValue values should be stored in a BLOB column rather than TEXT.
Andrei Popescu
Comment 2 2011-01-21 07:20:38 PST
WebKit Review Bot
Comment 3 2011-01-21 07:23:47 PST
Attachment 79732 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/stor..." exit_code: 1 Source/WebCore/platform/sql/SQLiteStatement.cpp:388: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 1 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Hans Wennborg
Comment 4 2011-01-21 09:10:25 PST
Comment on attachment 79732 [details] Patch Looks great. Some nits: > Source/WebCore/platform/sql/SQLiteStatement.cpp:190 > + return bindBlob(index, reinterpret_cast<const void*>(characters), text.length() * sizeof(UChar)); I believe static_cast is preferred. Sorry for not saying that earlier. > Source/WebCore/platform/sql/SQLiteStatement.cpp:391 > + return String(reinterpret_cast<const UChar*>(blob), size / sizeof(UChar)); Ditto. > Source/WebCore/platform/sql/SQLiteStatement.cpp:418 > } Ditto. > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:134 > + return runCommands(sqliteDatabase, commands, 12); Using '12' here seems a bit dangerous.. sizeof commands / sizeof commands[0] ? > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:144 > + return runCommands(sqliteDatabase, commands, 2); Ditto for 2. > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:187 > + if (!runCommands(sqliteDatabase, commands, 15)) Ditto. > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:205 > + if (!runCommands(sqliteDatabase, commands, 7)) Ditto.
Hans Wennborg
Comment 5 2011-01-21 09:14:35 PST
Comment on attachment 79732 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=79732&action=review >> Source/WebCore/platform/sql/SQLiteStatement.cpp:190 >> + return bindBlob(index, reinterpret_cast<const void*>(characters), text.length() * sizeof(UChar)); > > I believe static_cast is preferred. Sorry for not saying that earlier. In fact, I don't even think you need a cast here...
Andrei Popescu
Comment 6 2011-01-21 09:39:57 PST
Andrei Popescu
Comment 7 2011-01-21 09:41:39 PST
Thanks Hans! (In reply to comment #4) > (From update of attachment 79732 [details]) > Looks great. Some nits: > > > > Source/WebCore/platform/sql/SQLiteStatement.cpp:190 > > + return bindBlob(index, reinterpret_cast<const void*>(characters), text.length() * sizeof(UChar)); > > I believe static_cast is preferred. Sorry for not saying that earlier. > Removed cast altogether. > > Source/WebCore/platform/sql/SQLiteStatement.cpp:391 > > + return String(reinterpret_cast<const UChar*>(blob), size / sizeof(UChar)); > > Ditto. > Done. > > Source/WebCore/platform/sql/SQLiteStatement.cpp:418 > > } > > Ditto. > Done. > > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:134 > > + return runCommands(sqliteDatabase, commands, 12); > > Using '12' here seems a bit dangerous.. sizeof commands / sizeof commands[0] ? > Done. > > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:144 > > + return runCommands(sqliteDatabase, commands, 2); > > Ditto for 2. > Done. > > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:187 > > + if (!runCommands(sqliteDatabase, commands, 15)) > > Ditto. > Done. > > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:205 > > + if (!runCommands(sqliteDatabase, commands, 7)) > > Ditto. Done.
WebKit Review Bot
Comment 8 2011-01-21 09:43:13 PST
Attachment 79751 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/stor..." exit_code: 1 Source/WebCore/platform/sql/SQLiteStatement.cpp:388: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 1 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jeremy Orlow
Comment 9 2011-01-21 10:14:56 PST
Comment on attachment 79751 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=79751&action=review r=me >> Source/WebCore/platform/sql/SQLiteStatement.cpp:388 >> + if (size < 0 || size % sizeof(UChar) != 0) > > Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] The latter seems more like a sanity check...should we assert it's not true? The following / is safe in that we won't read invalid memory. > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:189 > get rid of second newline > Source/WebCore/storage/IDBFactoryBackendImpl.cpp:198 > + "INSERT INTO ObjectStoreData2 SELECT * FROM ObjectStoreData", I worry about this....and think we should probably just blow away the data. No one should have anything they really care about yet.
Andrei Popescu
Comment 10 2011-01-22 07:00:54 PST
Note You need to log in before you can comment on or make changes to this bug.