Skip to content

fix: Preserve embedded NUL characters in TEXT values - #634

Merged
lovasoa merged 1 commit into
sql-js:masterfrom
LiGuolongHAN:fix-embedded-nul-text
Oct 14, 2026
Merged

lovasoa merged 1 commit into
sql-js:masterfrom
LiGuolongHAN:fix-embedded-nul-text

Conversation

@LiGuolongHAN

Copy link
Copy Markdown
Contributor

Fix handling of SQLite TEXT values containing embedded NUL (\0) characters.

Previously, some JS ↔ SQLite string conversions treated TEXT as NUL-terminated, which could truncate values such as "A\0漢😄".

This change uses explicit UTF-8 byte lengths when passing strings into SQLite, and SQLite-reported byte lengths when reading them back.

It also adds regression tests for:

prepared statement parameters and query results;
JavaScript SQL function arguments and return values.

The new regression tests fail on the current master and pass with this fix. CI is green.

@lovasoa
lovasoa merged commit 83331b5 into sql-js:master Oct 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants