Skip to content

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

Open
LiGuolongHAN wants to merge 1 commit into
sql-js:masterfrom
LiGuolongHAN:fix-embedded-nul-text
Open

LiGuolongHAN wants to merge 1 commit into
sql-js:masterfrom
LiGuolongHAN:fix-embedded-nul-text

Conversation

@LiGuolongHAN

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
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.

1 participant