Repository navigation
Reject copying userdata with a destructor - #440
Open
Alearner12 wants to merge 1 commit into
Open
Alearner12 wants to merge 1 commit into
Alearner12 wants to merge 1 commit into
Conversation
Prevent independent wrappers from invoking the same opaque destructor twice. Preserve non-owning copies and document reference sharing. Extend the copy regressions to cover payload ownership and failure cleanup. Fixes vstakhov#431
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.
Fixes #431.
ucl_object_copy()duplicates a userdata pointer and destructor into independent wrappers. Copying a heap payload with afreedestructor and releasing both wrappers reproduces an ASan double-free in either release order.Reject copies with a destructor because the API has no payload-clone callback. Preserve non-owning copies and document
ucl_object_ref()for sharing ownership. Regressions cover release order, destructor counts, borrowed payloads, allocation failures and nested cleanup.Validation from the checkout's parent directory:
Both focused runs passed; regular CTest passed 21/21. Full ASan/UBSan passed 19/21. The two failures also reproduce on the untouched baseline: a
test_schemainput-buffer leak and null-pointer arithmetic intest_msgpack_malformed.