Repository navigation
Fix three nested-VFS defects: FullPathname off-by-one, urlencode stack overflow, Close() leak on Sync failure - #18
Merged
Conversation
1. FullPathname: terminate zPathOut at nPathOut-1, not nPathOut (one byte past the caller's buffer on every call). 2. urlencode: format the byte as unsigned char; a signed char >= 0x80 printed as FFFFFFxx, overrunning the 3-byte stack buffer on any non-ASCII filename (x86-64 Linux). 3. InnerDatabaseFile::Close: when the final Sync fails, still self-delete via SQLiteVFS::File::Close() before returning the error (as the exception path already does). The early return leaked the file object and its outer database connection, which holds locking_mode=EXCLUSIVE, leaving the outer database write-locked by a ghost for the process's remaining life. All three reproduced under AddressSanitizer before the fix and clean after (harness: exact-size FullPathname buffer, UTF-8 filename open, forced close-time Sync failure with lock probe).
Wid-L-Hacker
added a commit
to Wid-L-Hacker/sqlite_zstd_vfs
that referenced
this pull request
Oct 25, 2026
mlin
pushed a commit
that referenced
this pull request
Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three defects found by audit (all reproduced under AddressSanitizer before the fix, clean after), each a one-line fix in src/SQLiteNestedVFS.h:
Severity P1 on all three (edge-case triggers). Full analysis: ops record in the audit notes.