Fix wolfSSL_BUF_MEM_grow_ex with WOLFSSL_NO_REALLOC#10770
Open
embhorn wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an OpenSSL-compatibility-layer memory safety bug in wolfSSL_BUF_MEM_grow_ex() when WOLFSSL_NO_REALLOC is enabled, and adds CI coverage to catch it under ASAN.
Changes:
- Prevent out-of-bounds reads in the
WOLFSSL_NO_REALLOCgrow path by copying only the existing valid content (buf->length). - Add an API regression test that triggers the
malloc+copy+freepath and is detectable under ASAN/valgrind. - Extend the GitHub Actions smoke-test matrix with an
--enable-opensslextra+WOLFSSL_NO_REALLOCASAN job.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/api.c | Adds a regression test exercising BUF_MEM_grow() growth past buf->max to detect the prior over-read under sanitizers. |
| src/ssl.c | Fixes the WOLFSSL_NO_REALLOC grow implementation to copy only buf->length bytes from the old buffer. |
| .github/workflows/smoke-test.yml | Adds a new ASAN smoke-test configuration for --enable-opensslextra with -DWOLFSSL_NO_REALLOC. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10770
Scan targets checked: wolfssl-bugs, wolfssl-src
No new issues found in the changed files. ✅
|
retest this please |
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.
Description
With the compatibility layer and
WOLFSSL_NO_REALLOCenabled, there was a potential read out of the boundary inwolfSSL_BUF_MEM_grow_exThanks to Pelioro for submitting this issue.
Fixes zd22032
Testing
Added sanitizer test for this config
Checklist