Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport a few fixes for issues detected by Coverity #421

Draft
wants to merge 8 commits into
base: stable-0.9
Choose a base branch
from

Conversation

stefanberger
Copy link
Owner

No description provided.

… (Coverity)

Resolve the following Coverity complaint:

  "Using uninitialized value eccPublic when calling TPMS_ECC_POINT_Unmarshal."

Signed-off-by: Stefan Berger <[email protected]>
Resolve the following Coverity complaint by removing assignment to offset:

  "Assigning value from offset + 148UL to offset here, but that stored
   value is overwritten before it can be used."

Signed-off-by: Stefan Berger <[email protected]>
Resolve the following Coverity complaint:

  "Expression command->sessionNum - 1U, which is equal to 4294967295,
   where command->sessionNum is known to be equal to 0, underflows the
   type that receives it, an unsigned integer 32 bits wide."

Signed-off-by: Stefan Berger <[email protected]>
…verity)

Address the following Coverity complaint (1550494) by filtering out bad
input values:

  "Expression i--, which is equal to 65535, where i is known to be equal
   to 0, underflows the type that receives it, an unsigned integer 16 bits
   wide."

aSize is typcially 2048 and n is always >= 1 per the input parameter.
Therefore no side-effects are expected from this filter.

Signed-off-by: Stefan Berger <[email protected]>
Cast the '1' to UINT64 before shifting it.

Since the shift value is always below 32 it would have never exceeded
the 32bit value it was using before the cast.

Signed-off-by: Stefan Berger <[email protected]>
Address a false positive issue detect by Coverity (CID 1517797)
about *buflen.

Per this assignment of buflen

cached_blobs[st].buflen = buffer ? buflen : BUFLEN_EMPTY_BUFFER;

the following is true:

If cached_blobs[].buffer is     NULL then *buflen  = BUFLEN_EMPTY_BUFFER
If cached_blobs[].buffer is not NULL then *buflen != BUFLEN_EMPTY_BUFFER

Signed-off-by: Stefan Berger <[email protected]>
@stefanberger stefanberger marked this pull request as draft July 15, 2024 02:42
Since swtpm now depends on libtpms >= 0.10 use swtpm's stable-0.9
branch for testing.

Signed-off-by: Stefan Berger <[email protected]>
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.

1 participant