feat(libSceNKWebKit): implement the WebCore SQLite wrappers #20327
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20327"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Herolias on 2026-11-15T02:08:46Z.
What
Implements 56 libSceNKWebKit exports of the WebCore SQLite wrappers. All of them threw through
NotImplemented_nid_no_patchbefore.SQLiteDatabase, 17 exports: the constructors and destructors,open,close,executeCommand,tableExists,clearAllTables,runVacuumCommand,runIncrementalVacuumCommand,interrupt,lastError,lastErrorMsg,turnOnIncrementalAutoVacuum,setCollationFunctionand the staticsetIsDatabaseOpeningForbidden.SQLiteStatement, 27 exports:prepare,step,finalize,resetandexecuteCommand;bind*exports andbindParameterCount;isColumnNullandisColumnDeclaredAsBlob;getColumn*getters, including bothgetColumnBlobAsVectoroverloads.SQLiteTransaction, 7 exports: the constructors and destructors,begin,commitandrollback.SQLiteStatementAutoResetScope, 5 exports: the move constructors, move assignment and destructors. The two pointer constructors were already onmain.The wrappers call the sqlite3 exports of libSceNKWebKitRequirements (
sqlite3_*_nid_postfix, the bundled SQLite 3.54.1). Their VFS maps guest paths, soopenhands SQLite the guest path as UTF-8 and no host path is built here. libSceNKWebKit now links libSceNKWebKitRequirements privately. Requirements links only its bundled libraries, so this adds no cycle.Which WebKit the exports follow:
prepareStatementAPI:open(const String&, OpenMode),SQLiteStatement(SQLiteDatabase&, const String&),prepare,finalizeandgetColumn*.open(const String&, OpenMode, OptionSet<OpenOptions>)(NIDlCTp1S9tQ5Q) andprepareStatement.73a35b43be(August 2020).mainalready uses that revision for the 3.20DiagnosticLoggingKeysandProtectionSpaceBaseexports.tableExistsbinds the table name, as the 11.xtableExistsandtableSQLdo. August 2020tableExistsconcatenates the name between single quotes, so it reports an existing table namedit'emas missing.The layouts in
SQLiteAbi.hppare the release (!ASSERT_ENABLED) layouts of that revision, and each one is checked withstatic_assert:SQLiteDatabaseis 64 bytes. It hasWTF::Lockbytes at 14, 24 and 40,m_openErrorat 44, theCStringat 48 andm_lastChangesCountat 56.SQLiteStatementis 24 bytes: the database reference, the queryStringand thesqlite3_stmt*.SQLiteTransactionis 16 bytes.SQLiteStatementAutoResetScopeis 8 bytes.SQLValue(WTF::Variant<nullptr_t, String, double>) is 16 bytes, with asigned charindex at 8.WTF::Functionis a pointer to aCallableWrapperBase. Slot 1 of its vtable is the deleting destructor and slot 2 iscall.The code reuses the existing
WtfTextAbi,WtfStringandWtfVectorhelpers.String::utf8,StringView::utf8,String(const UChar*, unsigned)andCString(const char*)go through this library's own exports.Inputs that throw, recorded in the debt fragment:
isColumnDeclaredAsBlobthrows for a column without a declared type. WebKit passes the nullsqlite3_column_decltyperesult toStringView(const char*), which callsstrlen.isColumnDeclaredAsBlobalso throws for SQL thatprepareleaves without a statement.runIncrementalVacuumCommandandsetCollationFunctionthrow on a closed database. WebKit passes the null handle tosqlite3_set_authorizerandsqlite3_create_collation_v2. Those dereference it unless SQLite was built withSQLITE_ENABLE_API_ARMOR, and the console's SQLite build is unknown.bindValuethrows for a valuelessVariant.WTF::Function.std::invalid_argument, as the other libSceNKWebKit wrappers do.Deviations, also in the fragment:
WTF::Lockbyte is contended, the code yields until it is free. It does not park, because theWTF::ParkingLotexports still throw.m_openingThreadstays null becauseWTF::Thread::currentis not implemented. Release builds read it only in assertions.m_authorizerstays null becausesetAuthorizeris not exported.Depends on #19550, merged as
627a70cfe0:open,closeof a WAL database anduseWALJournalModeconstructSQLiteTransactionInProgressAutoCounter, so they callSQLiteDatabaseTracker::increment/decrementTransactionInProgressCount.SQLiteTransactioncalls the tracker only onPLATFORM(IOS_FAMILY)at this revision, so it does not.The 7
SQLiteFileSystemexports still throw and are left for a follow-up.Debt:
docs/dev/debt/changes/feat-webcore-sqlite.mdadds six Functional entries and removes the 38 inventory rows of these exports. The other 18 exports came fromLegacyExports.hpp, which has no inventory rows.Overlap:
tools/pr_overlap.py --namesfound no open pull request for these functions. The 4 tracker exports came from #19550, which is merged.tools/pr_overlap.py --branchexited with status 2 againstmainat851212fb98. It listed textual conflicts with 7 of the 189 pull requests that share a file or exports, and three more share exports:SQLiteones this change removes inExport.cpp,InventoryExports.hppandLegacyExports.hpp.target_link_librariesline that this change extends withlibSceNKWebKitRequirements. #23752 adds its header at the same place as this change inlibSceNKWebKit.hpp; it implementsSQLiteFileSystem::ensureDatabaseDirectoryExists, one of theSQLiteFileSystemexports this change leaves throwing.SQLiteDatabase,SQLiteStatementorSQLiteTransactionline, and in each case whoever merges second keeps both sides.Export.cppstub, theSQLiteones this change removes included, into newchunks/Export_Chunk*.cppfiles and build those instead ofExport.cpp. They implement none of them. Whichever merges second has to drop the copies of these stubs.main: #13515, #14138, #14164, #14259, #15170, #16510, #17550, #17569, #17771, #17793, #17805, #17912, #17917, #17933, #18395, #19486, #20326, #22556, #22557, #22674, #22678, #22680, #22684, #22689, #22937, #23159, #23181, #23468, #23755, #23757, #23758, #23772, #23847, #23999, #24000, #24009, #24019, #24154, #24319, #24322, #24332, #24339, #24347, #24350, #24504, #24516, #24550, #24867, #24873, #24910 and #24917.mainand from this branch in a directory outside the repository, withgit apply --reject.SQLiteline.SQLiteline this change deletes, or thetarget_link_librariesline it extends, in its context. They edit neighbouring stubs, declarations or inventory rows inExport.cpp,InventoryExports.hppandLegacyExports.hpp, or theadd_libraryline above the link line inCMakeLists.txt. Whichever merges second keeps both changes.SQLiteDatabase's C1 constructor from their wrappers, and their tests define a mock of it, as they do for exportsmainalready implements, such asWTF::fastMalloc.Tested
Fedora 44 x86-64, GCC 16.2.1, GNU ld 2.46.1, CMake 4.3.0, Ninja 1.13.2, Release with
-DBUILD_TESTING=ON. I ran no title, homebrew or console, because I have none.On
a535586053, the merge withmainat851212fb98:libSceNKWebKit.hpp, where #23743 added a header at the same place as this change. The resolution keeps both, and the branch's own diff againstmainis unchanged.cmake --build buildbuilt the whole tree, with no warning in a libSceNKWebKit file.nkwebkit_sqlitedatabase,nkwebkit_sqlitedatabasetracker,public_headersandpatched_self_imports.tools/check_conventions.py --base origin/mainpassed for the branch, the title and this body, andgit diff --checkis clean.tools/debt_fold.py --checkfails here with the same two errors as onmainat851212fb98, both inlibkernel_sysfragments frommain(docs-libkernel-pro-measured-1360.mdandfix-kernel-sys-title-workaround-bit-limit.md). On an exported copy of the branch without those two fragments, it passed.Earlier, on
979460a282, the merge withmainatc8f72e905c:libSceNKWebKit/CMakeLists.txt, where #22977 addedlibcairoto thetarget_link_librariesline that this change extends withlibSceNKWebKitRequirements, and in the include list oflibSceNKWebKit.hpp, where #23888 and #23746 added headers at the same place as this change. Both were resolved by keeping both sides. The branch's own diff againstmainis unchanged, except that itstarget_link_librariesline now carriesmain'slibcairotoo.cmake --build buildbuilt the whole tree, with no warning in a libSceNKWebKit file.nkwebkit_sqlitedatabase,nkwebkit_sqlitedatabasetracker,public_headersandpatched_self_imports.tools/check_conventions.py --base origin/mainpassed for the branch, the title and this body,git diff --checkis clean, andtools/debt_fold.py --checkpassed.Earlier, on
e467f5ccab, the merge withmainat0afe9ef689:Export.cpp, where #23471 removed theFrameLoader::pageIDstub right after theSQLiteStatement::prepareone this change removes, and in the include list oflibSceNKWebKit.hpp, where #22561, #23723 and #23737 added headers at the same place as this change. The resolution keeps both sides of each, and the branch's own diff againstmainis unchanged.cmake --build buildbuilt the whole tree, with no warning in a libSceNKWebKit file.nkwebkit_sqlitedatabase,nkwebkit_sqlitedatabasetracker,public_headersandpatched_self_imports.tools/check_conventions.py --base origin/mainpassed for the branch, the title and this body,git diff --checkis clean, andtools/debt_fold.py --checkpassed.Earlier, on
31579cbef6, the merge withmainata9b7dbb49b:Export.cppandInventoryExports.hpp: #22997 removed thetopPrivatelyControlledDomainstub and inventory declaration right next to the fiveSQLiteStatementAutoResetScopeones this change removes. The resolution keeps both removals, and the branch's own diff againstmainis unchanged.cmake --build buildbuilt the whole tree, with no warning in a libSceNKWebKit file.nkwebkit_sqlitedatabase,nkwebkit_sqlitedatabasetracker,public_headersandpatched_self_imports(thelibSceLibreSsl3.prxself-import is fixed onmainby #22877).tools/check_conventions.py --base origin/mainpassed for the branch, the title and this body,git diff --checkis clean, andtools/debt_fold.py --checkpassed.Earlier, on
8c9a194615, the merge withmainat6119c53c4b:Export.cppandLegacyExports.hpp: #22555 removed theDisplayList::DrawingItemdestructor stub and declaration right next to theSQLiteStatement::getColumnBlobAsVectorones this change removes. The resolution keeps both removals, and the branch's own diff againstmainis unchanged.cmake --build buildbuilt the whole tree, with no warning in a libSceNKWebKit file.nkwebkit_sqlitedatabaseandnkwebkit_sqlitedatabasetracker.patched_self_importsfailed onlibSceLibreSsl3.prx, which this change does not touch. Since #22804, itsRSA_free_nid_disambig1_nid_postfixcalls libSceLibreSsl'sRSA_free_nid_postfix, so after NID patching the module imports5zpup0URQoc, a name it also exports. #22877 fixes that.tools/check_conventions.py --base origin/mainpassed for the branch, the title and this body,git diff --checkis clean, andtools/debt_fold.py --checkpassed.Earlier, on
eef5852428, the merge withmainat852c263177, which includes #19550:libSceNKWebKit/CMakeLists.txt, wheremainaddedicu_commonto thetarget_link_librariesline that this change extends withlibSceNKWebKitRequirements, and in the include list oflibSceNKWebKit.hpp. Both were resolved by keeping both sides. The branch's own diff againstmainis unchanged.cmake --build buildbuilt the whole tree, with no warning in a libSceNKWebKit file.nkwebkit_sqlitedatabaseandnkwebkit_sqlitedatabasetrackeron this branch alone, with no local merge.patched_self_importsfailed onlibSceLibreSsl3.prx, which this change does not touch. Since #22804, itsRSA_free_nid_disambig1_nid_postfixcalls libSceLibreSsl'sRSA_free_nid_postfix, so after NID patching the module imports5zpup0URQoc, a name it also exports. #20326 on the samemainfails it the same way.tools/check_conventions.py --base origin/mainpassed for the branch, the title and this body,git diff --checkis clean, andtools/debt_fold.py --checkpassed. With and without this change's fragment,--showdiffers by the six Functional entries and the 38 inventory rows.Earlier, on
95e864a225:NotImplemented:runIncrementalVacuumCommandandsetCollationFunctionon a closed database,bindValuewith a valuelessVariant, andisColumnDeclaredAsBlobon a column without a declared type. A maintainer said on #21981 that such checks record a gap rather than a behaviour. Those paths still throw, and the debt fragment records them.cmake --build buildbuilt the whole tree. The only warnings weremain's threetmpnamlink warnings in libjxr and one C++23 lambda warning inlibSceAgcDriver/Execution/src/VulkanDevice.cpp, none in a libSceNKWebKit file.nkwebkit_sqlitedatabaseaborts on this branch alone, on the #19550 dependency, as described below.db0a13b034), the tree built and all 105nkwebkittests passed.nkwebkit_sqlitedatabaseandnkwebkit_sqlitedatabasetrackerpassed 3 repeats each.tools/check_conventions.py --base origin/mainpassed, andgit diff --checkis clean.Earlier, on
edf208d408, the merge withmainatbe4613dd73(conflicts inlibSceNKWebKit/CMakeLists.txtandlibSceNKWebKit.hpp, each resolved by keeping both sides):cmake --build buildbuilt the whole tree, with no warning in a libSceNKWebKit file.nkwebkit_sqlitedatabaseaborts on this branch alone, as described below.db0a13b034), the tree built and all 108nkwebkittests passed.nkwebkit_sqlitedatabaseandnkwebkit_sqlitedatabasetrackerpassed 3 repeats each.x86_64-w64-mingw32-g++ -fsyntax-onlywith the UCRT defines passed forSQLite.cpp,tests/SQLiteDatabase.cppandExport.cpp.mainthen moved toc3668a6b22, whose #17868 changes libSceNKWebKit. On a local merge with it, libSceNKWebKit and everynkwebkittest target built, and 106 of the 107nkwebkittests passed.nkwebkit_sqlitedatabaseaborted on the #19550 dependency.tools/check_conventions.py --base origin/mainpassed, andgit diff --checkis clean.Earlier, on
mainat782522d11d:cmake --build buildbuilt the whole tree. The only warnings were the four already onmain: threetmpnamlink warnings in libjxr and one-Wc++23-extensionsinlibSceAgcDriver/Execution/src/VulkanDevice.cpp.tools/select_tests.py(BUILD.md, "Selective test builds") was 1131 of 5508 tests and 234 build targets. 1130 passed and none skipped.nkwebkit_sqlitedatabase, the new test, aborts on this branch alone at the firstopen. The cause is_ZN7WebCore21SQLiteDatabaseTracker35incrementTransactionInProgressCountEv not implemented, which is the dependency on #19550.a4bf0aa1cf) with #19550 (head1b3ce192b4):nkwebkittests passed;nkwebkit_sqlitedatabaseandnkwebkit_sqlitedatabasetrackerpassed 3 repeats each;tableExists,nkwebkit_sqlitedatabasefails at theit'emcheck (line 185).43f5ca701dwithmainatb7aeb6f406and #19550 (head1b3ce192b4):SQLite.cppcompiles. Before43f5ca701dit did not:maingained an unscopedWKImeEventTypeenumerator namedOpen(a86589fc8d), which made the call to the file-localOpenhelper ambiguous, so the helper is nowOpenDatabase;nkwebkittests passed, andnkwebkit_sqlitedatabaseandnkwebkit_sqlitedatabasetrackerpassed 3 repeats each;guest_icu_recovered_signatures_tests, withmultiple definition of GuestPointers::Run()in libSceIcu test files that this branch does not touch.nkwebkit_sqlitedatabasemaps a temporary directory to the guest prefix/webcore-sqlitewithAddPathAlias_nid_no_patch. It checks:0xA5storage;lastErrorand "database is not open";preparereturningSQLITE_MISUSE,bindBlobreturningSQLITE_ERRORandbindIntreturningSQLITE_MISUSE.SQLITE_CANTOPENand "unable to open database file", and creates no file;-walfile appear in the mapped directory, andjournal_modeiswal;prepare;SQLITE_ERROR;printfis reported unauthorized;lastErrorMsg;tableExists:it'emis missing before the table is created, found afterwards, and missing again after the drop;it''emis not found whileit'emexists;x'; DROP TABLE items; --is missing while no such table exists, is found once a table has that name, anditemsis still there in both cases;x' OR '1'='1, an empty name and%are missing.bind*export;bindValuewith each alternative;Stringbound as text gives an empty value;getColumn*getter, plus out-of-range columns;isColumnDeclaredAsBlobon declared columns;getColumnBlobAsVector: a new vector gets capacity 16, a buffer of capacity 20 is reused, and a null blob clears the vector;finalizefollowed bystep.BEGIN.SQLiteStatementAutoResetScope: move construction and move assignment hand the statement over, and the destructor resets it.WTF::Functioncollation (REVERSE) is moved out, called, and destroyed once through its deleting destructor atclose;runVacuumCommand;turnOnIncrementalAutoVacuum, after whichauto_vacuumreads 2;runIncrementalVacuumCommandandinterrupt;clearAllTableskeepssqlite_sequence;tools/check_conventions.py --base origin/mainpassed for the branch, the title and this body.tools/debt_fold.py --checkfails onmainatdocs/dev/debt/changes/feat-icu-ulist.mdline 3, which is not part of this change. On a copy of the tree with that fragment set aside, it passed both with and without this change's fragment.Sources
All WebKit links are to commit
73a35b43be7ae44c084885bd3fa4b403e59723c8unless noted otherwise.SQLiteDatabasemembers, defaults and release layout (m_sharableonly withASSERT_ENABLED)SQLiteDatabase.hlines 159-180SQLiteStatementlayout (reference,String,sqlite3_stmt*;m_isPreparedonly withASSERT_ENABLED)SQLiteStatement.hlines 96-101SQLiteTransactionlayoutSQLiteTransaction.hlines 53-55CanMakeWeakPtrbase, nom_lastChangesCount)80f77e94,SQLiteDatabase.hlines 52-205WTF::Lockis one atomic byte with bit 1 heldLock.hlines 50-131SQLValueisVariant<nullptr_t, String, double>; the index is asigned char, and -1 is valuelessSQLValue.hline 36;Variant.hlines 260-262 and 1701-1703WTF::Functionholds aunique_ptr<CallableWrapperBase>, whose virtuals are the destructor andcallFunction.hlines 36-41 and 122setIsDatabaseOpeningForbidden, andopen: forbidden message, open flags,sqlite3_open_v2and its error message, unauthorized functions, extended result codes,temp_storeunder the tracker counter, WAL unless read-onlySQLiteDatabase.cpplines 74-161fileSystemRepresentationisutf8()outside CocoaFileSystemPOSIX.cpplines 415-418-shmblock does nothing outside iOSFileSystem.cpplines 393-402useWALJournalMode,close(WAL close under the tracker counter),overrideUnauthorizedFunctionsandunauthorizedSQLFunctionSQLiteDatabase.cpplines 196-259 and lines 48-55SQLiteDatabaseTracker::increment/decrementTransactionInProgressCountSQLiteDatabaseTracker.hlines 44-55executeCommand,clearAllTables, the vacuum commands,interrupt,lastError,lastErrorMsgSQLiteDatabase.cpplines 374-475tableExistsbinds the name and returns whether thesqlcolumn of the matching row is non-empty80f77e94,SQLiteDatabase.cpplines 458-472enableAuthorizer,turnOnIncrementalAutoVacuum,setCollationFunctionand the collation call and destroy callbacksSQLiteDatabase.cpplines 571-631prepare: locks the database mutex, strips whitespace, converts to UTF-8, passes the length plus 1, and turns a non-empty tail intoSQLITE_ERRORSQLiteStatement.cpplines 56-83stripWhiteSpaceusesisSpaceOrNewline:isASCIISpacefor Latin-1, otherwiseu_charDirection == U_WHITE_SPACE_NEUTRALWTFString.cpplines 370-378;StringImpl.cpplines 727-757;StringImpl.hlines 770-774SQLiteStatement, from the constructor togetColumnBlobAsVector; thereturnTextResultshelperSQLiteStatement.cpplines 44-55 and 85-468Stringbinds a non-null pointer of length 0StringView.hlines 387-411 and 542-554isColumnDeclaredAsBlobpasses the declared type toStringView(const char*), which callsstrlenSQLiteStatement.cpplines 278-286;StringView.hlines 351-354Vector::resizegrows tomax(size, max(16, capacity + capacity / 4 + 1)), crashes aboveUINT_MAX / sizeof(T), andclearfrees the bufferVector.hlines 290-310, 770, 1053-1056, 1094-1108, 1184-1208 and 1223-1251SQLiteTransactioncalls the tracker only onPLATFORM(IOS_FAMILY)SQLiteTransaction.cpplines 37-104SQLiteStatementAutoResetScopemove construction, move assignment and destructorSQLiteStatementAutoResetScope.cpplines 34-55SQLITE_MISUSEfromsqlite3_prepare_v2, and a null statement gives it frombindandstep3rdparty/sqlite3.54.1 (57520227c9),src/prepare.clines 869-875 andsrc/vdbeapi.clines 54-61SQLITE_ENABLE_API_ARMOR, a null handle is dereferenced bysqlite3_create_collation_v2,sqlite3_set_authorizerandsqlite3_column_decltypesrc/main.clines 3835-3838,src/auth.clines 70-78 andsrc/vdbeapi.clines 1562-1573main(Export.cpp,InventoryExports.hpp,LegacyExports.hpp), which come from the PS5 3.20 export inventory described indocs/dev/debt/libSceNKWebKit.md; the pin names were taken from itsWEBCORE_EXPORTdeclarations, andtools/nid_names.py --offline --namegiveslCTp1S9tQ5Qfor itsopenChecklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T02:11:22Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
498b8c5e5d:tools/check_conventions.pypassed;git diff --checkreported whitespace errors.nkwebkit_sqlitedatabase_testsbuilt cleanly.nkwebkit_sqlitedatabase):Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T03:33:43Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
22580af2c2:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_sqlitedatabase_testsbuilt cleanly.nkwebkit_sqlitedatabase):Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T04:50:45Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: safely bind the table name in
tableExistsso names containing quotes cannot alter the SQL query.What I ran
Reviewed head
22580af2c2fe3563bd0c9997a4f015ff55ab4a9fand the prepared patch withrepo_read.py. No commands or tests were run. Author-reported test results are not treated as runs performed for this review.Results
tableExistsFindings
Blocking
core/libs/prx/libSceNKWebKit/src/SQLite.cpp:658—tableExistsconcatenatestableNamedirectly into a quoted SQL string. A name containing an apostrophe can break out of the literal and alter the query, so the method can report misleading results and execute injected SQL during statement preparation. Use a bound parameter for the name.Non-blocking
None.
Not verified
No build or tests were run. The full text of
Export.cppandInventoryExports.hppwas excluded from the review folder; targeted searches confirmed the old stubs are absent fromExport.cppand the SQLite tracker declarations remain inInventoryExports.hpp, but the complete files were not read. Reviewed changed files:CMakeLists.txt,LegacyExports.hpp,SQLiteExports.hpp,libSceNKWebKit.hpp,SQLite.cpp,SQLiteAbi.hpp,tests/SQLiteDatabase.cpp, andfeat-webcore-sqlite.md. Excluded from the folder:Export.cppandInventoryExports.hpp.To get this to a good state
Bind the table name as a parameter and add coverage for names containing apostrophes and SQL syntax; then rerun the relevant SQLite test.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T16:04:11Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: escape or bind table names in
tableExistsso quoted names are matched correctly and SQL metacharacters cannot alter the query.What I ran
5c2adbca9c1d26d31bc9dbbe39232f53bcb9b964usingrepo_read.py.Results
tableExistsinterpolates the table name into SQLFindings
Blocking
core/libs/prx/libSceNKWebKit/src/SQLite.cpp:658constructs a SQL string with the caller-provided name between single quotes. A table namedit'emis therefore not found, and a name containing SQL syntax can alter the query. The added test expects the quoted-name case to fail (SQLiteDatabase.cpp:185), which codifies the wrong behavior; change the implementation to bind the name as a parameter and cover quoted names and injection attempts.Non-blocking
None.
Not verified
CMakeLists.txt,LegacyExports.hpp,SQLiteExports.hpp,libSceNKWebKit.hpp,SQLite.cpp,SQLiteAbi.hpp,tests/SQLiteDatabase.cpp, anddocs/dev/debt/changes/feat-webcore-sqlite.md.Export.cppandinclude/InventoryExports.hppwere excluded from the review folder as too large; their diff hunks were available indiff.patch, but their full text was not read.To get this to a good state
tableExists, and update the regression test to require correct handling of quoted names while confirming injected SQL does not execute.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T17:31:50Z.
Review: COMMENTED
Reviewed — comments
The implementation is extensively covered by the supplied host tests, but the declared tracker dependency is still stubbed in the target branch and no run against the merged dependency was performed by this review.
What I ran
Reviewed head
43f5ca701dfe4ae32e2acc7c70ce501db757b555. I did not run commands or tests. I read the prepared description, commits, diff, manifest, README, and the included changed-file contents; I also read the repository source for tracker stubs and SQLite requirements.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceNKWebKit/src/SQLite.cpp:280calls tracker functions that remainNotImplemented_nid_no_patchin this head’sExport.cpp(lines 21646–21652). The description explicitly makes this PR depend on #19550, and reports that the SQLite test aborts without that dependency. Please ensure #19550 is merged or otherwise included before relying on this implementation; on the standalone head, database open can throw during the transaction counter.Not verified
files.jsonwas not available as a file, so exclusions were checked from the manifest and README instead.Export.cppandInventoryExports.hppwere excluded from the prepared full-text files because they are too large, but the relevant tracker stub and declaration were read through the pinned repository reader. All other changed files were included; their full text was not all read.To get this to a good state
Nothing is required. Optional: merge or include the stated #19550 dependency before running the SQLite database test on the combined branch.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T17:44:13Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the review found one optional error-handling improvement.
What I ran
Reviewed head
edf208d408f10882553a4cf34e329873ddf4a3ceusing the prepared diff and the pinnedrepo_read.pyreader. I ran no build or tests; Linux and MinGW checks below are author-reported.Results
Findings
Blocking
None.
Non-blocking
SQLiteDatabase::openignores failures from installing unauthorized SQL functions. If registration fails, the database still opens without the intended overrides. Consider checking eachsqlite3_create_functionresult and handling failure consistently with the later open initialization checks.core/libs/prx/libSceNKWebKit/src/SQLite.cpp:570Sources
Not verified
CMakeLists.txt,SQLiteExports.hpp,SQLite.cpp,SQLiteAbi.hpp, andtests/SQLiteDatabase.cpp; inspected relevant portions ofdiff.patch,manifest.json,description.md, andcommits.md.Export.cppandInventoryExports.hppwere excluded from the prepared bundle as too large; their relevant hunks were visible indiff.patch.LegacyExports.hppand the debt fragment were listed in the manifest but not read in full.To get this to a good state
Nothing is required. Optionally check and handle errors from the unauthorized-function registrations.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T01:46:04Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
95e864a225(95e864a22516a559d0b2df1d181ad1a7b23c0047), basemain. No merge preview.repo_read.py search:Export.cppandInventoryExports.hppare not infiles/(too large), so they were read only as hunks.files.jsonwas not read.Results
SQLite.cppmatchSQLiteExports.hppExport.cpp:21408,:21412)CStringBufferlayoutBytes()assumesSqlite.hppheaderGuestSqliteDestructorLenientConversionvalueConversionModeis not in the repositoryStringViewUTF-8 export was not foundFindings
Blocking
None in the changed hunks I read.
Non-blocking
core/libs/prx/libSceNKWebKit/src/SQLite.cpp:374:Preparecallssqlite3_prepare_v2onstatement.statementwithout finalizing a statement already held. Calling the exportedprepare()twice on one statement leaks the firstsqlite3_stmt.ReturnTextResultsalready finalizes first, so a small fix isif (statement.statement) Finalize(statement);before the call.core/libs/prx/libSceNKWebKit/src/SQLite.cpp:588:CallCollationFunctioncallsNotImplemented_nid_no_patchfrom a callback that SQLite invokes from C code. The debt fragment records a throw but not that the throw crosses SQLite's frames. I could not read the helper, so I cannot confirm what happens there.core/libs/prx/libSceNKWebKit/src/SQLite.cpp:701:clearAllTablesbuildsDROP TABLEfrom the raw table name. A table whose name contains a space or a quote is not dropped, and the false result ofExecuteCommandis ignored. The new test covers neither case. The form appears to follow the upstream source the PR cites; I did not check that source.Not verified
SQLite.cpp:374readsquery.buffer->lengthwith no null check. Whether theStringViewUTF-8 export returns a nullCStringfor a null string was not verified.SQLite.cpp:248:LenientConversion = 0depends on theConversionModeenum, which is not in the repository.NotImplemented_nid_no_patch: its definition was not found, so the behaviour in findings 2 and in the other throw paths is not confirmed.SQLite.cpp:518:ClosekeepsuseWALandtransactionInProgress. These sit in the 64-byte layout that guest code can read. Whether upstreamclose()resets them was not checked.SQLiteStatementsearch oversrc/was cut at 57 of 175 lines.SQLiteDatabaseandSQLiteTransactionnames undersrc/were not searched. The lines that were shown contained no duplicate definition.static_asserts check the sizes only when the tree is built.Export.cppandInventoryExports.hpp: only their changed hunks were read.files.jsonwas not read.Sources
Repository paths at
95e864a22516. No external source was fetched.To get this to a good state
Nothing is required. Merge after #19550, which this change depends on: at head the tracker counter exports still throw, so every read-write
open()fails until it lands.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T12:15:37Z.
Review: COMMENTED
Reviewed — comments
The reviewed implementation adds the WebCore SQLite wrappers; one edge case in
clearAllTablesneeds attention for unusual table names.What I ran
Reviewed head
eef58524284e205665737cfd4340962f60ad577d. I ran no commands or tests. Build and test results in the PR description are author reported.Results
Negative control
Not run; no test change was made during this review.
Findings
Blocking
None.
Non-blocking
clearAllTablesinserts each table name directly into aDROP TABLEstatement. Names containing spaces or SQL identifier punctuation are not quoted, so those tables may remain after the method returns. Quote identifiers or use a safe identifier-quoting helper. Seecore/libs/prx/libSceNKWebKit/src/SQLite.cpp:701.Sources
Not verified
The full
Export.cppandInventoryExports.hpptexts were excluded from the review bundle; their changed hunks were visible indiff.patch. The full 2,230-lineLegacyExports.hppwas not read. No tests or build were run independently.Read:
description.md,commits.md,manifest.json,diff.patch,CMakeLists.txt,LegacyExports.hpp(lines 1–30),SQLiteExports.hpp,libSceNKWebKit.hpp(changed hunk in diff),SQLite.cpp,SQLiteAbi.hpp, andtests/SQLiteDatabase.cpp. Excluded from full-text review:Export.cppandInventoryExports.hpp.To get this to a good state
Nothing is required. Optional: quote table identifiers in
clearAllTablesso names with spaces or punctuation are dropped correctly.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T13:48:16Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
8c9a194615:tools/check_conventions.pypassed.nkwebkit_sqlitedatabase_testsbuilt cleanly.nkwebkit_sqlitedatabase):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/SQLite.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T14:34:06Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected implementation and quoted-name handling show no verified blocking defect, but this review is incomplete because two changed files were excluded from the review bundle and I did not run the checks.
What I ran
Reviewed head
8c9a1946153803a5d495c602f837978ea6a004a0. I did not run commands or tests; the reported Fedora build and test results are author-supplied.Results
Negative control
Not run; no code change or test assertion was made during this review.
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Sources
The reviewed implementation is pinned to SQLite.cpp at this head. The
tableExistsimplementation binds the table name as a parameter, avoiding SQL interpretation of quoted or injected names.Not verified
I read the prepared description, commits, manifest, diff, and the included changed files
core/libs/prx/libSceNKWebKit/CMakeLists.txt,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/SQLiteExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/SQLite.cpp,core/libs/prx/libSceNKWebKit/src/SQLiteAbi.hpp,core/libs/prx/libSceNKWebKit/tests/SQLiteDatabase.cpp, anddocs/dev/debt/changes/feat-webcore-sqlite.md. The full text ofcore/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppwas excluded as too large; I inspected their diff hunks only. I did not verify console behavior or independently reproduce the author-reported build and test results.To get this to a good state
Nothing is required. Optional: complete review of the two excluded files and run the checks on this head before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T00:57:51Z.
Review: COMMENTED
Reviewed — comments
Formal approval is not justified because two changed files were excluded from the review materials and no checks were run in this session.
What I ran
Reviewed head
31579cbef645a8ee54bcca03a55ba811aa6c344ausing the prepared review materials and the pinned repository reader. No build or tests were run in this session. The description reports prior build and test results; those were not independently run here.Results
Negative control
Not run.
Findings
Blocking
None verified.
Non-blocking
None.
Sources
Reviewed the prepared diff and source at the pinned head; no behavior claims requiring external sources are made.
Not verified
The full text of
core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppwas excluded by the review folder’s size rule. The manifest, diff, and prepared description were read; the complete manifest and diff were not read. The reviewed source ranges included all ofsrc/SQLite.cpp,include/SQLiteExports.hpp,libSceNKWebKit.hpp, and the changed CMake line; selected ranges oftests/SQLiteDatabase.cppwere read. The full text ofsrc/SQLiteAbi.hppand the other included changed files was not verified.To get this to a good state
Nothing is required. Optional: include the excluded files and run the relevant build and tests before requesting formal approval.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T22:17:22Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: resolve the non-blocking correctness and coverage points below.
What I ran
e467f5ccab9565f94a7a151ebd5ceed2e404f4f9; no commands or tests were run.CMakeLists.txt,SQLiteExports.hpp,libSceNKWebKit.hpp,SQLite.cpp,SQLiteAbi.hpp,tests/SQLiteDatabase.cpp, andfeat-webcore-sqlite.md. Also inspected relevant diff hunks and the included review-folder README.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceNKWebKit/src/SQLite.cpp:681:tableExiststreats a table as existing only when itssqlite_master.sqltext is nonempty. SQLite storesNULLSQL for internal tables such assqlite_sequence, so this reports that table as missing even while it exists. The test checkssqlite_sequenceinSQLiteDatabase.cpp:350and:353, but does not calltableExistsfor it. Check whether theSELECTreturns a row instead of testing the SQL text.core/libs/prx/libSceNKWebKit/src/SQLite.cpp:609:RollbackclearsinProgressandtransactionInProgressregardless of whetherROLLBACKsucceeds. A failed rollback can leave the connection in a transaction while the wrapper reports it is no longer active. Consider checking the command result before updating the state, and add a test that exercises a rollback failure.Not verified
Export.cppandinclude/InventoryExports.hppwere excluded from the review folder and their changed ranges were not read. Therefore, I could not confirm the full export/declaration removals.description.mdsays the build and selected tests passed on Fedora 44 with GCC 16.2.1, but I did not run those checks. Console behavior was not tested.To get this to a good state
Nothing is required for merge based on the inspected code. Optional: make
tableExistshandle SQLite entries withNULLSQL and retain transaction state when rollback fails; add focused tests for both cases.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T17:20:05Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected SQLite implementation has no verified blocking defect, but this review is incomplete because several changed files were not read.
What I ran
Reviewed head
979460a282057c8152647785afd439de3913ac52using the pinnedrepo_read.pyreader. No build or tests were run; the checks described in the PR body are author-reported.Results
Findings
Blocking
None verified in the code read.
Non-blocking
None.
Not verified
Read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch(selected ranges),core/libs/prx/libSceNKWebKit/src/SQLite.cpp, andcore/libs/prx/libSceNKWebKit/src/SQLiteAbi.hpp.Not read: remaining changed files in
manifest.json, includingExport.cppandinclude/InventoryExports.hpp(excluded from the review folder as too large), as well as the complete diff and all changed tests. Build, tests, console behavior, and the author-reported checks were not independently verified.To get this to a good state
Nothing is required. The reviewed code showed no blocking defect; this is a partial review, so a formal approval is not justified.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T04:48:16Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: review the excluded export files and address the table-name handling noted below.
What I ran
Reviewed head
a5355860530e265a5de97f37e8f1f76e8e3c99c0; I ran no build or tests. The description reports Fedora build and test results, but those were not run in this review.Results
Findings
Blocking
None verified.
Non-blocking
clearAllTablesinserts catalog table names directly intoDROP TABLESQL without quoting them. Legal identifiers containing spaces, reserved words, or quotes will fail to drop, so the method does not clear all tables for those databases. Quote and escape each identifier before executing the drop. (core/libs/prx/libSceNKWebKit/src/SQLite.cpp:701)Not verified
core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppwere excluded as too large and were not read; export registration and inventory consistency are therefore not verified. No console, title, or homebrew behavior was tested. The description’s build and test results were not independently confirmed.Reviewed files:
core/libs/prx/libSceNKWebKit/CMakeLists.txt,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/SQLiteExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/SQLite.cpp,core/libs/prx/libSceNKWebKit/src/SQLiteAbi.hpp,core/libs/prx/libSceNKWebKit/tests/SQLiteDatabase.cpp, anddocs/dev/debt/changes/feat-webcore-sqlite.md.To get this to a good state
Nothing is required. Consider quoting table identifiers in
clearAllTables; also review the two excluded export files before treating export registration as confirmed.