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

Fix incomplete error check on ASN1_item_i2d() #20251

Closed
wants to merge 1 commit into from

Conversation

nielsdos
Copy link
Contributor

@nielsdos nielsdos commented Feb 9, 2023

According to the documentation and my analysis tool ASN1_item_i2d() can return a negative value on error, but this is not checked. Fix it by changing the error check condition.

CLA: trivial

Please note that I found this using a static analysis tool I am developing at the moment. It could therefore be a false positive bug. I manually reviewed the case to be extra sure that it is a real bug.

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

According to the documentation and my analysis tool
ASN1_item_i2d() can return a negative value on error,
but this is not checked. Fix it by changing the error check condition.

CLA: trivial
@paulidale paulidale added branch: master Merge to master branch approval: review pending This pull request needs review by a committer triaged: bug The issue/pr is/fixes a bug branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 labels Feb 9, 2023
@slontis
Copy link
Member

slontis commented Feb 10, 2023

Not sure if there is a way to test this easily. -1 gets returned on malloc failures, but also for bad tags.
There is no documentation related to ASN1_item_i2d() that I can see.

@t8m t8m added cla: trivial One of the commits is marked as 'CLA: trivial' tests: exempted The PR is exempt from requirements for testing labels Feb 12, 2023
Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

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

OK with CLA: trivial

@paulidale assuming you're OK with CLA: trivial too.

@t8m t8m added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Feb 12, 2023
@openssl-machine
Copy link
Collaborator

24 hours has passed since 'approval: done' was set, but this PR has failing CI tests. Once the tests pass it will get moved to 'approval: ready to merge' automatically, alternatively please review and set the label manually.

@tmshort
Copy link
Contributor

tmshort commented Feb 23, 2023

The CI failure does not seem relevant.
Ping @paulidale ?

@paulidale
Copy link
Contributor

paulidale commented Feb 28, 2023

Yes to trivial.
Merged.

Thanks for the contribution.

@paulidale paulidale closed this Feb 28, 2023
openssl-machine pushed a commit that referenced this pull request Feb 28, 2023
According to the documentation and my analysis tool
ASN1_item_i2d() can return a negative value on error,
but this is not checked. Fix it by changing the error check condition.

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #20251)

(cherry picked from commit 5df5032)
openssl-machine pushed a commit that referenced this pull request Feb 28, 2023
According to the documentation and my analysis tool
ASN1_item_i2d() can return a negative value on error,
but this is not checked. Fix it by changing the error check condition.

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #20251)

(cherry picked from commit 5df5032)
openssl-machine pushed a commit that referenced this pull request Feb 28, 2023
According to the documentation and my analysis tool
ASN1_item_i2d() can return a negative value on error,
but this is not checked. Fix it by changing the error check condition.

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #20251)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: done This pull request has the required number of approvals branch: master Merge to master branch branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 cla: trivial One of the commits is marked as 'CLA: trivial' tests: exempted The PR is exempt from requirements for testing triaged: bug The issue/pr is/fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants