Allow tests to directly call loader internal functions & Always memset newly reallocated memory #1629
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.
This prevents conflicts with the loaders and tests platform abstractions.
There is no advantage to dynamically linking googletest into the loader test framework. Removing it also removes some CMake code that copies the gtest.dll, which is a nice benefit.
This allows the fuzz tests to faithfully recreate the calling environment
of OSS-Fuzz, meaning reproduction of failing fuzz tests can be done in the
repo for regression testing.
The implementation of this requires exporting several functions that the
fuzz tests need which is done with a new macro that is only active when
a specific compiler definition is set, which the build does when testing
is active.
Fuzz testing found a case where memory was left uninitialized after
calling loader_realloc, causing a crash due to reading of that memory.
The fix is to always memset newly reallocated memory, since a value of
zero is a good default value, especially if that memory is for a list.
This commit removes the redundant memsets, since realloc now has the
responsibility to initialize memory.
Test case for the previous commit that was discovered later - more test cases is rarely a bad thing.