Skip to content

Coverity issues involving negative arguments#14620

Closed
paulidale wants to merge 7 commits intoopenssl:masterfrom
paulidale:coverity-negative-argument
Closed

Coverity issues involving negative arguments#14620
paulidale wants to merge 7 commits intoopenssl:masterfrom
paulidale:coverity-negative-argument

Conversation

@paulidale
Copy link
Copy Markdown
Contributor

  • documentation is added or updated
  • tests are added or updated

@paulidale paulidale added branch: master Applies to master branch approval: review pending This pull request needs review by a committer labels Mar 19, 2021
@paulidale paulidale added this to the Sprint Lithium milestone Mar 19, 2021
@paulidale paulidale self-assigned this Mar 19, 2021
@paulidale paulidale closed this Mar 19, 2021
@t8m
Copy link
Copy Markdown
Member

t8m commented Mar 19, 2021

Was this closed intentionally? Although maybe we should just change those _size() calls to return 0 instead of negative values.

@paulidale paulidale reopened this Mar 19, 2021
@paulidale
Copy link
Copy Markdown
Contributor Author

paulidale commented Mar 19, 2021

No, I must have closed it by accident. Lots of these outstanding at present.

@t8m
Copy link
Copy Markdown
Member

t8m commented Mar 19, 2021

I really wonder if introducing the negative return value for these calls was right.

@paulidale
Copy link
Copy Markdown
Contributor Author

These are mostly historic calls, so we have to live with them.
A new call that did something like this would be different. Then again, a new call that returns a size as an int is suspect from the start.

@paulidale
Copy link
Copy Markdown
Contributor Author

ping for review

@paulidale
Copy link
Copy Markdown
Contributor Author

Still feeling unrequited review.

@t8m
Copy link
Copy Markdown
Member

t8m commented Mar 26, 2021

I'm still a little bit worried for the cases where we are newly introducing the negative error return value in 3.0. This can have quite serious impact in applications if they aren't properly ready to handle negative error returns.

@paulidale
Copy link
Copy Markdown
Contributor Author

This isn't introducing any such functions. I don't think it's checking the returns from any either.

DH_size(), EVP_CIPHER_CTX_key_length() and EVP_CIPHER_CTX_iv_length() are all pre-existing.

I agree, it's a concern and we really shouldn't be doing it.

@t8m
Copy link
Copy Markdown
Member

t8m commented Mar 26, 2021

DH_size(), EVP_CIPHER_CTX_key_length() and EVP_CIPHER_CTX_iv_length() are all pre-existing.

I do not think DH_size() and EVP_CIPHER_CTX_key_length() can ever return < 0 values in 1.1.1.
EVP_CIPHER_CTX_iv_length() is pre-existing.

I am not saying this PR is introducing it. I am saying 3.0 introduces it. So maybe the right fix for this PR is to actually drop the negative returns for these.

Okay I understand now. DH_size() hasn't changed between versions. I've not dug through the EVP_CIPHER_CTX_key_length() paths yet.

@paulidale
Copy link
Copy Markdown
Contributor Author

In essence, you are suggesting returning zero from EVP_CIPHER_CTX_key_length() instead of the EVP_CTRL_RET_UNSUPPORTED value. I'm not convinced that this is a good idea. 0 or negative returns are both going to cause problems.

All we're saving are the programs that check == 0 instead of <= 0.

Our documentation isn't forgiving here: negative and zero returns are not mentioned.

@FdaSilvaYY
Copy link
Copy Markdown
Contributor

Ping @openssl ; This PR is falling into the limbo.

@paulidale paulidale force-pushed the coverity-negative-argument branch from 171454f to 02b4bcd Compare April 6, 2021 12:39
@paulidale
Copy link
Copy Markdown
Contributor Author

Rebased to latest master, still waiting for a review or a suggestion about the negative return changes required.

Copy link
Copy Markdown
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

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

This looks fine to me. This PR isn't introducing any changes which causes functions to return <0 where they didn't before. So, if that has occurred it is out of scope of this PR to fix it IMO.

@mattcaswell mattcaswell removed the approval: review pending This pull request needs review by a committer label Apr 6, 2021
@mattcaswell mattcaswell added the approval: done This pull request has the required number of approvals label Apr 6, 2021
@paulidale paulidale modified the milestones: Sprint Lithium, 3.0.0 beta1 Apr 7, 2021
@openssl-machine openssl-machine added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Apr 7, 2021
@openssl-machine
Copy link
Copy Markdown
Collaborator

This pull request is ready to merge

@paulidale
Copy link
Copy Markdown
Contributor Author

Merged to master, thanks for the comments etc.

@paulidale paulidale closed this Apr 7, 2021
@paulidale paulidale deleted the coverity-negative-argument branch April 7, 2021 22:50
openssl-machine pushed a commit that referenced this pull request Apr 7, 2021
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #14620)
openssl-machine pushed a commit that referenced this pull request Apr 7, 2021
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #14620)
openssl-machine pushed a commit that referenced this pull request Apr 7, 2021
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #14620)
openssl-machine pushed a commit that referenced this pull request Apr 7, 2021
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #14620)
openssl-machine pushed a commit that referenced this pull request Apr 7, 2021
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #14620)
openssl-machine pushed a commit that referenced this pull request Apr 7, 2021
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #14620)
openssl-machine pushed a commit that referenced this pull request Apr 7, 2021
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #14620)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Applies to master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants