- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 10.9k
Remove redundant OPENSSL_assert(i <= n) checks in b64_write() #27401
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would actually make sense to replace all the OPENSSL_assert() calls in this file with proper ossl_assert() calls guarded by ifs and returning errors.
Currently, the code asserts that the return value of BIO_write() does not exceed n bytes. However, other calls to BIO_write() do not perform such a check. Since there is no special handling in b64_write() that would require this assertion, it is safe to remove it.
| Thank you! Updated. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failures aren't relevant. Commits to be squashed when merging.
| This pull request is ready to merge | 
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from #27401)
| Squashed and merged to the master branch. Thank you for your contribution. | 
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from openssl#27401)
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from openssl#27401)
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from openssl#27401)
Currently, the code asserts that the return value of BIO_write() does not exceed n bytes. However, other calls to BIO_write() do not perform such a check.
Since there is no special handling in b64_write()
that would require this assertion, it is safe to remove it.
Checklist
P.S. I noticed this assertion while reading the code. Although it has not caused any issues, it led me to check whether there are any cases where BIO_write() might return
i > n.