Fenrir fixes#347
Merged
cconlon merged 21 commits intowolfSSL:masterfrom Mar 31, 2026
Merged
Conversation
70a7c96 to
e8d0e94
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses multiple robustness and correctness fixes in the wolfJSSE Java provider and its JNI wrappers, primarily around session cache handling and safer JNI resource/thread management.
Changes:
- Fix session cache resizing to preserve existing cached sessions.
- Harden multiple JNI entrypoints by guarding
ReleaseByteArrayElementscalls whenGetByteArrayElementsreturnsNULL. - Fix JVM thread leaks in native verify callbacks by detaching threads that were temporarily attached, and add additional bounds/resource safety fixes (e.g., serial number buffer bounds, allocate output array before
SetByteArrayRegion).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/java/com/wolfssl/provider/jsse/WolfSSLAuthStore.java | Fixes resizeCache copy direction so existing sessions aren’t lost during resize. |
| native/com_wolfssl_WolfSSLX509Name.c | Adds NULL-guard for releasing byte array elements (but still needs NULL-guard for releasing string chars). |
| native/com_wolfssl_WolfSSLSession.c | Detaches JNI-attached threads in session-level verify callback to prevent thread leaks. |
| native/com_wolfssl_WolfSSLCRL.c | Adds NULL-guards before ReleaseByteArrayElements in several CRL-related JNI methods. |
| native/com_wolfssl_WolfSSLContext.c | Detaches JNI-attached threads in context-level verify callback to prevent thread leaks. |
| native/com_wolfssl_WolfSSLCertRequest.c | Adds NULL-guards before ReleaseByteArrayElements in several CSR JNI methods. |
| native/com_wolfssl_WolfSSLCertManager.c | Guards against NULL GetByteArrayElements result before calling wolfSSL_CertManagerLoadCABuffer. |
| native/com_wolfssl_WolfSSLCertificate.c | Adds bounds check for ASN1_INTEGER serial copy and NULL-guards for releasing byte arrays in multiple X509-related JNI methods. |
| native/com_wolfssl_WolfSSL.c | Allocates the output jbyteArray in x509_getDer before setting contents (but needs additional safety fixes). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
@JeremiahM37 Take a look over Copilot feedback above, and please rebase on master, thanks! |
e8d0e94 to
8d920ad
Compare
4768b1b to
9526632
Compare
Contributor
Author
|
Added a unit test for testResizeCachePreservesEntries I forgot to commit. |
Contributor
Author
|
Jenkins retest this please |
cconlon
approved these changes
Mar 31, 2026
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.
● Fixes F-1729, 1730, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743,1744, 1745, 1746, 1747, 1750, 1752, 1753.