Repository navigation
Fails gracefully when allocation fails during array/map construction - #224
Merged
Merged
Conversation
James-ZHANG
force-pushed
the
fix-bad-memory-access
branch
from
September 29, 2022 21:54
4228cd4 to
41fab92
Compare
Owner
|
Apologies for the delay and thanks a ton for the PR! Isn't there still a problem with the memory cleanup? I think that when a nested _cbor_builder_append fails, all the partially built items on the ctx->stack should be freed up, but creation_failed is never checked as we "unwind the stack" |
Contributor
Author
Those are already freed up in I think the invariant of Added a function comment emphasizing that. |
James-ZHANG
force-pushed
the
fix-bad-memory-access
branch
from
November 10, 2022 23:55
eaa7dc9 to
bcc2841
Compare
Owner
|
Makes sense, thank you! This could use better docs, filed #226 |
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.
Fails gracefully when allocation fails during array/map construction
Description
Return values of
cbor_array_push,_cbor_map_add_keyand_cbor_map_add_valueare unchecked. An uncheckedfalsereturn value here implies potential out-of-bound memory access.Checklist
No
No
No
No