Skip to content

20260729 Coverity fixes - #11006

Open
rlm2002 wants to merge 3 commits into
wolfSSL:masterfrom
rlm2002:coverity
Open

20260729 Coverity fixes#11006
rlm2002 wants to merge 3 commits into
wolfSSL:masterfrom
rlm2002:coverity

Conversation

@rlm2002

@rlm2002 rlm2002 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

CID 561836: Untrusted value as argument - Bound untrusted DER length before allocation in wolfssl_read_der_bio
CID 561978: Uninitialized scalar variable - Initialize enc in test_coding.c to avoid use before set.
CID 562025: Data race condition - Lock globalRNG in AddSession when falling back to the global RNG

Testing

./configure --enable-jni && make check

@rlm2002 rlm2002 self-assigned this Jul 29, 2026
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

@rlm2002 rlm2002 assigned wolfSSL-Bot and unassigned rlm2002 Jul 29, 2026

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🐺 Skoll Code Review

Overall recommendation: REQUEST_CHANGES
Findings: 12 total — 4 posted, 8 skipped

Posted findings

  • [High] globalRNGMutex leaked when wc_RNG_GenerateBlock() fails in AddSession()src/ssl_sess.c:2172-2185
  • [Medium] initGlobalRNG is not re-checked after taking the lock (documented racy pattern elsewhere)src/ssl_sess.c:2167-2177
  • [Medium] No test exercises the new oversized-DER rejection pathsrc/pk_rsa.c:654-659
  • [Low] test_coding.c change guards the read but does not initialize enc as the PR describestests/api/test_coding.c:328-347
Skipped findings
  • [High] globalRNGMutex leaked on wc_RNG_GenerateBlock failure path in AddSession
  • [High] globalRNGMutex left locked when wc_RNG_GenerateBlock() fails in AddSession()
  • [Medium] DER size cap expression (RSA_MAX_SIZE / 8) * 8 reduces to RSA_MAX_SIZE and contradicts its comment
  • [Medium] AddSession() global-RNG locking path has no regression test
  • [Medium] initGlobalRNG not re-checked after acquiring globalRNGMutex in AddSession (races wolfSSL_RAND_Cleanup)
  • [Low] Misindented return block does not match wolfSSL brace/indent style
  • [Info] DER cap expression (RSA_MAX_SIZE / 8) * 8 is a no-op and its comment contradicts the code
  • [Info] New error-return block in AddSession() uses non-conforming indentation

Review generated by Skoll via Claude/Codex

Comment thread src/ssl_sess.c Outdated
Comment thread src/ssl_sess.c
Comment thread src/pk_rsa.c
Comment thread tests/api/test_coding.c
@Frauschi Frauschi assigned rlm2002 and unassigned wolfSSL-Bot Jul 31, 2026

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🐺 Skoll Code Review

Overall recommendation: REQUEST_CHANGES
Findings: 7 total — 2 posted, 5 skipped

Posted findings

  • [High] New test's preprocessor guard does not match the API it calls - link failure in OPENSSL_EXTRA-without-OPENSSL_ALL buildstests/api.c:20494-20520
  • [High] Test installs a raw malloc callback while leaving the previous free/realloc callbacks in place - invalid free in --enable-trackmemory buildstests/api.c:20502-20551
Skipped findings
  • [Medium] Bit-count constant RSA_MAX_SIZE compared against a byte length
  • [Medium] Triple-duplicated unlock blocks and a garbled comment in AddSession
  • [Medium] No test coverage for the new globalRNG locking path in AddSession
  • [Low] enc[outLen - 1] still underflows if Base64_Encode returns outLen == 0
  • [Low] Redundant #ifndef NO_BIO block in testCases[] and a free of an always-NULL pointer

Review generated by Skoll via Claude/Codex

Comment thread tests/api.c Outdated
Comment thread tests/api.c Outdated
Test oversized DER is rejected before allocation

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@rlm2002 rlm2002 assigned wolfSSL-Bot and unassigned rlm2002 Aug 4, 2026

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Over to @philljj as he's reviewing another PR with similar global mutex fixes

@dgarske
dgarske requested a review from philljj August 5, 2026 03:47
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.

5 participants