sqlite: always copy changeset before applying - #65870
Conversation
SQLite can invoke JavaScript through user-defined SQL functions while applying a changeset, even when no filter or conflict callback is set. Copy non-empty changesets unconditionally so JavaScript cannot detach or modify the input while SQLite is still reading it. Signed-off-by: Kamat, Trivikram <[email protected]> Assisted-by: codex
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #65870 +/- ##
==========================================
- Coverage 90.19% 90.18% -0.01%
==========================================
Files 771 771
Lines 264628 264627 -1
Branches 50237 50235 -2
==========================================
- Hits 238683 238658 -25
- Misses 16953 16960 +7
- Partials 8992 9009 +17
🚀 New features to boost your workflow:
|
|
It seems the same as Matteo did in his first implementation. If we're on this endeavor, I'd rather have track of all the user defined functions and prevent them being called on all the surfaces. WDYT? |
Created #65880 to track registered user-defined functions separately. Can we keep this PR focused on protecting the changeset buffer while preserving existing SQL function behavior? |
|
Landed in f9072f3 |
Refs: #65286 (comment)
SQLite can invoke JavaScript through user-defined SQL functions while applying a changeset, even when no filter or conflict callback is set. Copy non-empty changesets unconditionally so JavaScript cannot detach or modify the input while SQLite is still reading it.
Assisted-by: codex