Fix reliance on undefined behaviour and other Linux test issues#30
Merged
johannessen merged 5 commits intomainfrom Oct 19, 2025
Merged
Fix reliance on undefined behaviour and other Linux test issues#30johannessen merged 5 commits intomainfrom
johannessen merged 5 commits intomainfrom
Conversation
Co-authored-by: npc1054657282 <npc1054657282@users.noreply.github.com>
This changes the interface for the constructors neo4j_node(), neo4j_relationship(), neo4j_unbound_relationship(); but these are internal functions, only called from struct_deserialize(). So this change doesn't affect the public API. For Bolt v3/v4, which don't have element IDs, struct_deserialize() generates a replacement string.
Passing a null pointer as buffer to strftime() is undefined behaviour in ISO C, even though many standard library implementations allow it, treating it like a zero-length buffer. Our documentation of neo4j_ntostring() never mentions that you can pass a null pointer as buffer. Instead, it says that a pointer must be "a buffer", implying that NULL would be a usage error. However, it looks like NULL was in fact always supported, all the way back to the beginnings of libneo4j-client. This change special-cases zero-length buffers in the temporal *_str functions and updates the documentation to indicate that NULL is a supported value for the buffer pointer.
The spatial and temporal *_fprint functions relied on the positive return value of fputs() being the number of bytes written, but that's undefined behaviour in ISO C. This change replaces fputs() with fprintf().
Collaborator
Author
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.
Resolves #15.