Don't declare WC_ALLOC_DO_ON_FAILURE by default#9905
Open
julek-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
Open
Don't declare WC_ALLOC_DO_ON_FAILURE by default#9905julek-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
julek-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates allocation-failure handling by removing the default WC_ALLOC_DO_ON_FAILURE definition from the core header and making tests explicitly define (or avoid relying on) that behavior.
Changes:
- Removed the default
WC_ALLOC_DO_ON_FAILURE()definition fromwolfssl/wolfcrypt/types.h. - Added explicit
WC_ALLOC_DO_ON_FAILURE()definitions in select test files. - Updated Chacha API test to use
WC_ALLOC_VAR_EX/WC_FREE_VAR_EXwith explicit failure/cleanup handling.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfssl/wolfcrypt/types.h | Removes default allocation-failure hook macro from a public header. |
| wolfcrypt/test/test.c | Adds a local WC_ALLOC_DO_ON_FAILURE() definition for tests. |
| tests/api/test_rsa.c | Defines WC_ALLOC_DO_ON_FAILURE() for RSA API tests. |
| tests/api/test_aes.c | Defines WC_ALLOC_DO_ON_FAILURE() for AES API tests. |
| tests/api/test_chacha.c | Switches to _EX alloc/free macros and adds a cleanup path on allocation failure. |
Comments suppressed due to low confidence (1)
wolfcrypt/test/test.c:1
WC_ALLOC_DO_ON_FAILURE()is defined mid-file (and apparently inside a function body). With the default removed fromtypes.h, anyWC_ALLOC_VARusages earlier in this translation unit will no longer see this macro and may fail to compile. Define this at file scope near the top of the file (or in a shared test header included before any uses) so it consistently applies to the entire compilation unit.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.