Fix various issues with pool management / access #125
Merged
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.
Constants are usually retrieved from the constant pool without verifying that the pool actually contains them, which may lead to various heap buffer overflow issues.
In this PR we add a counter keeping track of how many elements the pool contains, and checks making sure that whenever the pool is accessed, the constant in present in the pool (constant position < pool counter).
Also, do not return "" when a pointer is excepted (it should be legal to free this return value).
This PR fixes #112 (CVE-2018-7875), fixes #120 (CVE-2018-7871), fixes #117 (CVE-2018-7870), fixes #114 (CVE-2018-7872), fixes #122, fixes #113 (CVE-2018-7868), fixes #123.
Lots of non trivial stuff here, careful review would be really helpful.