Skip to content

fix bad behavior in marshal for empty buffers/strings#16

Merged
paulfitz merged 2 commits intogrist-mainfrom
paulfitz/assertions
Mar 16, 2026
Merged

fix bad behavior in marshal for empty buffers/strings#16
paulfitz merged 2 commits intogrist-mainfrom
paulfitz/assertions

Conversation

@paulfitz
Copy link
Copy Markdown
Member

When built with _GLIBCXX_ASSERTIONS (as in Flatpak environments), allMarshal crashes on empty result sets or empty string/blob values due to out-of-bounds vector/string access via operator[]. Fix by using .data() and guarding _writeBytes against zero-length writes.

Add tests for empty result sets, empty strings, and empty blobs. Add build:assert script and CI step to catch this class of bug.

When built with _GLIBCXX_ASSERTIONS (as in Flatpak environments),
allMarshal crashes on empty result sets or empty string/blob values
due to out-of-bounds vector/string access via operator[]. Fix by
using .data() and guarding _writeBytes against zero-length writes.

Add tests for empty result sets, empty strings, and empty blobs.
Add build:assert script and CI step to catch this class of bug.
Copy link
Copy Markdown
Member

@dsagal dsagal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you Paul!

@paulfitz paulfitz merged commit f341103 into grist-main Mar 16, 2026
6 checks passed
@paulfitz paulfitz deleted the paulfitz/assertions branch March 16, 2026 13:44
paulfitz added a commit to gristlabs/grist-core that referenced this pull request Mar 23, 2026
Summary:
Upgrades the fork of node-sqlite3 we use to deal with a memory
access issue: gristlabs/node-sqlite3#16

Test Plan: existing tests should pass

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4886
wvengen added a commit to wvengen/flathub that referenced this pull request Apr 13, 2026
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