jsonbuilder: attempt to handle memory allocation errors - v3#8901
Closed
jasonish wants to merge 4 commits into
Closed
jsonbuilder: attempt to handle memory allocation errors - v3#8901jasonish wants to merge 4 commits into
jasonish wants to merge 4 commits into
Conversation
Some very minor changes to formatting.
Convert "new_object" and "new_array" functions that return a Result and use "try_reserve" to allocate the amount of data requested. This should allow memory allocation errors to be detected and handled in a Rust-ful matter without resorting to catching a panic. Ticket: OISF#6057
Before growing any buffers use try_reserve to reserve the space required as this will return an error on allocation failures. Ticket: OISF#6057
Required minor updates to users of the base64 crate.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #8901 +/- ##
==========================================
- Coverage 82.30% 82.30% -0.01%
==========================================
Files 969 969
Lines 273335 273378 +43
==========================================
+ Hits 224960 224992 +32
- Misses 48375 48386 +11
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Information: QA ran without warnings. Pipeline 13846 |
Contributor
|
commit-check failed ? |
Member
Author
Yeah, got sloppy rebasing. Will fixup today or tomorrow. |
Member
Author
|
Fixed: #8916 |
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.
Previous PR: #8855
Ticket: https://redmine.openinfosecfoundation.org/issues/6057
Changes from previous PR:
Not addressed:
pushwill reserve more than it should need, not sure if this is a much of a win anyways.