Skip to content

JNI callback hardening: exception paths, leaks, and missing checks#370

Open
JeremiahM37 wants to merge 4 commits into
wolfSSL:masterfrom
JeremiahM37:fenrir-jni-cb-hardening
Open

JNI callback hardening: exception paths, leaks, and missing checks#370
JeremiahM37 wants to merge 4 commits into
wolfSSL:masterfrom
JeremiahM37:fenrir-jni-cb-hardening

Conversation

@JeremiahM37
Copy link
Copy Markdown
Contributor

Fixes F-3909, F-3910, F-3912, F-3913, F-3914, F-3915, F-3916

  • RsaVerifyCb, RsaSignCheckCb, RsaPssSignCheckCb: return -1 after CallIntMethod raises (was: continued with undefined retval, could surface success)
  • WolfSSLEngine wrap/unwrap exit debug loops: iterate ofst..ofst+len instead of 0..len so logging never reads outside the requested slice
  • Null-check GetStringUTFChars in setCipherList/set1SigAlgsList/setOCSPOverrideUrl (Session + Context) and return MEMORY_E on failure
  • setCRLCb: bail when NewGlobalRef fails; clear native callback when caller passes NULL
  • WolfCryptRSA doSign/doEnc and WolfCryptECC doSign: check wc_InitRng / key init returns, track init flags, free only on success (matches doPssSign)
  • NativeIORecvCb: DeleteLocalRef(ctxRef) on g_sslIORecvMethodId-null branch (matches NativeIOSendCb)

@JeremiahM37 JeremiahM37 self-assigned this May 11, 2026
@JeremiahM37 JeremiahM37 force-pushed the fenrir-jni-cb-hardening branch from d484db4 to 986549a Compare May 11, 2026 20:13
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #370

Scan targets checked: wolfssljni-bugs, wolfssljni-src

No new issues found in the changed files. ✅

@JeremiahM37 JeremiahM37 assigned cconlon and unassigned JeremiahM37 May 11, 2026
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