Uh oh!
There was an error while loading. Please reload this page.
sqlite: fix undefined behaviour in Session::Changeset() - #63637
Conversation
If `nChangeset == 0`, the pointer `pChangeset` may be nullptr. Passing a nullptr to `memcpy()` is undefined behaviour. This can be triggered by running the test suite under UBSAN. Signed-off-by: ndossche <nora.dossche@ugent.be>
nodejs-github-bot
commented
May 29, 2026
Review requested:
|
louwers
commented
May 29, 2026
If
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #63637 +/- ##
==========================================
- Coverage 90.30% 90.29% -0.02%
==========================================
Files 730 730 Lines 234802 234804 +2 Branches 43957 43951 -6 ==========================================
- Hits 212041 212017 -24 - Misses 14485 14493 +8 - Partials 8276 8294 +18
🚀 New features to boost your workflow:
|
Well, I tested this without error injection, so perhaps the documentation is wrong. This success return path takes the size and pointer from the |
Renegade334
left a comment
There was a problem hiding this comment.
This success return path takes the size and pointer from the
bufobject, which is initialized to all zero bytes at the start of the function. If the loop does not run then both the pointer and size will be nullptr/0.
This analysis appears correct to me, although libc's are realistically going to handle this gracefully, even if technically UB.
(It's becoming defined behaviour in c2y 😃)
ndossche
commented
May 29, 2026
Right, although the main concern is what a smart compiler may do ;p
Fortunately |
louwers
commented
May 29, 2026
OK maybe we should report this upstream, the SQLite folks are amazingly responsive. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
nodejs-github-bot
commented
Aug 6, 2026
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Aug 6, 2026
Landed in c18fd90 |
If `nChangeset == 0`, the pointer `pChangeset` may be nullptr. Passing a nullptr to `memcpy()` is undefined behaviour. This can be triggered by running the test suite under UBSAN. Signed-off-by: ndossche <nora.dossche@ugent.be> PR-URL: #63637 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
If `nChangeset == 0`, the pointer `pChangeset` may be nullptr. Passing a nullptr to `memcpy()` is undefined behaviour. This can be triggered by running the test suite under UBSAN. Signed-off-by: ndossche <nora.dossche@ugent.be> PR-URL: #63637 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
If `nChangeset == 0`, the pointer `pChangeset` may be nullptr. Passing a nullptr to `memcpy()` is undefined behaviour. This can be triggered by running the test suite under UBSAN. Signed-off-by: ndossche <nora.dossche@ugent.be> PR-URL: #63637 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
If
nChangeset == 0, the pointerpChangesetmay be nullptr. Passing a nullptr tomemcpy()is undefined behaviour. This can be triggered by running the test suite under UBSAN.Note: this was found by a static-dynamic analyser I'm developing.