Conversation
- fjson_tokener_new_ex() rejected no depth check: depth <= 0 called calloc(0, ...) and fjson_tokener_reset() then wrote stack[0], a heap buffer overflow. Reject depth < 1 up front. - fjson_tokener_new_ex() ignored a printbuf_new() failure, leaving tok->pb == NULL to be dereferenced during parsing. Check it and clean up on failure. - the object-key strdup() failure was unchecked; a NULL key is later treated as an empty slot and also passed to strcmp(). Bail out with an error instead.
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.
Summary by cubic
Hardens tokener initialization and object-key parsing against allocation failures.
fjson_tokener_new_ex()now rejects depths below 1 and cleans up whenprintbuf_new()fails, while parsing aborts with an error if duplicating an object key fails instead of continuing with a NULL key.Written for commit 8db922e. Summary will update on new commits.