Open
Conversation
|
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.



what
Addition custom YAJL memory allocators: yajl_fmalloc and yajl_ffree.
These allocators use APR pool memory (apr_palloc), instead of YAJL's default malloc/free.
base_offset is now copied into the APR pool, not used as a direct pointer to the input buffer
why
The original version stores offsets pointing directly into the buffer delivered by ModSecurity (stack or temporary memory). If YAJL internally modifies or frees memory, the parser may reference invalid memory.
Copying the buffer into APR’s pool ensures memory remains valid for the duration of the transaction.
Using APR memory everywhere ensures that all buffers follow ModSecurity’s allocation model.
example of issue
On a Windows, sending a request with the following json:
"content":"<p>blabla, ...Otherwise, click <em>Register</em>.</p>","postCategory":And receiving
"content":"<p>blabla, ...Otherwise, click <em>Register</em>.</p> egister</em>.</p>","postCategory":Full log:
(This was a Marc Stern modification)