Skip to content

null derefernce sanity checks and control flow issue#8695

Merged
douzzer merged 4 commits intowolfSSL:masterfrom
JacobBarthelmeh:coverity
Apr 22, 2025
Merged

null derefernce sanity checks and control flow issue#8695
douzzer merged 4 commits intowolfSSL:masterfrom
JacobBarthelmeh:coverity

Conversation

@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

Some warnings flagged by Coverity

@JacobBarthelmeh JacobBarthelmeh requested a review from Copilot April 18, 2025 22:53
@JacobBarthelmeh JacobBarthelmeh self-assigned this Apr 18, 2025
@JacobBarthelmeh JacobBarthelmeh added the For This Release Release version 5.9.1 label Apr 18, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces additional null checks and adjusts control flow to address Coverity‐flagged warnings and potential null dereferences. Key changes include null argument validations in hpke.c and ssl_sess.c, updated test cases in tests/quic.c, a refined condition in ssl_load.c, and a restoration of the hsHashes pointer in internal.c.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
wolfcrypt/src/hpke.c Added null checks for hpke and context parameters to prevent dereferencing.
tests/quic.c Added a test to verify that a null argument returns the expected error.
src/ssl_sess.c Introduced a null check in wolfSSL_SESSION_get_max_early_data to return BAD_FUNC_ARG.
src/ssl_load.c Adjusted the condition to execute RSAPSSk-related logic only when ret equals 0.
src/internal.c Restored the hsHashes pointer before returning on error.
Comments suppressed due to low confidence (1)

src/ssl_load.c:1115

  • The revised condition now requires ret to equal 0 before checking if *keyFormat is RSAPSSk, which may inadvertently bypass the RSAPSSk logic when ret is non-zero. Please verify that this control flow change is intended and that no valid cases are missed.
if((ret == 0) && (*keyFormat == RSAPSSk)) {

@douzzer
Copy link
Copy Markdown
Contributor

douzzer commented Apr 20, 2025

retest this please (java.io.StreamCorruptedException: invalid stream header: 636F7272)

@douzzer douzzer merged commit 25cd009 into wolfSSL:master Apr 22, 2025
186 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants