Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing heap hint in RNG health test XMALLOC call #8326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gasbytes
Copy link
Contributor

@gasbytes gasbytes commented Jan 2, 2025

Pass provided heap hint to XMALLOC instead of NULL in RNG health test function to ensure proper memory allocation with custom heap.
Reported by zd#19102.

@@ -2184,7 +2184,7 @@ static int wc_RNG_HealthTestLocal(int reseed, void* heap, int devId)
#endif

#ifdef WOLFSSL_SMALL_STACK
check = (byte*)XMALLOC(RNG_HEALTH_TEST_CHECK_SIZE, NULL,
check = (byte*)XMALLOC(RNG_HEALTH_TEST_CHECK_SIZE, heap,
Copy link
Contributor

@JacobBarthelmeh JacobBarthelmeh Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an FYI WOLFSSL_SMALL_STACK builds have a lot of NULL heap hints throughout the library. For this pull request, with adding in the heap hint here, please also add it to the XFREE call at the end of the function around line 2307 and any other location that 'check' is free'd.

Pass provided heap hint to XMALLOC instead of NULL in RNG health test
function to ensure proper memory allocation with custom heap.
@gasbytes gasbytes force-pushed the patch-rng-health-test-heap-hint branch from fb7899b to d491e54 Compare January 10, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants