FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

crypto: fix UB in computing max message size by bnoordhuis · Pull Request #21462 · nodejs/node · GitHub

/ node Public

crypto: fix UB in computing max message size - #21462

Closed
bnoordhuis wants to merge 0 commit into
nodejs:masterfrom
bnoordhuis:fix-crypto-auth-iv-ub
Closed

crypto: fix UB in computing max message size#21462
bnoordhuis wants to merge 0 commit into
nodejs:masterfrom
bnoordhuis:fix-crypto-auth-iv-ub

Conversation

Copy link
Copy Markdown
Member

Before this commit it computed (1<<(8*(15-iv_len)))-1 for iv_len>=11
and that reduces to (1<<32)-1 for iv_len==11. Left-shifting past
the sign bit and overflowing a signed integral type are both undefined
behaviors.

This commit switches to fixed values and restricts the iv_len==11
case to INT_MAX, as was already the case for all iv_len<=10.

bnoordhuis requested a review from tniessen June 22, 2018 11:11

Copy link
Copy Markdown
Collaborator

nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. labels Jun 22, 2018
bnoordhuis closed this Jun 25, 2018
bnoordhuis force-pushed the fix-crypto-auth-iv-ub branch from 6bdf825 to 19fe529 Compare June 25, 2018 21:46
bnoordhuis added a commit to bnoordhuis/io.js that referenced this pull request Jun 25, 2018
Before this commit it computed `(1<<(8*(15-iv_len)))-1` for `iv_len>=11`
and that reduces to `(1<<32)-1` for `iv_len==11`.  Left-shifting past
the sign bit and overflowing a signed integral type are both undefined
behaviors.

This commit switches to fixed values and restricts the `iv_len==11`
case to `INT_MAX`, as was already the case for all `iv_len<=10`.

PR-URL: nodejs#21462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
bnoordhuis deleted the fix-crypto-auth-iv-ub branch June 25, 2018 21:46

Copy link
Copy Markdown
Member Author

Landed in 19fe529.

targos pushed a commit that referenced this pull request Jun 26, 2018
Before this commit it computed `(1<<(8*(15-iv_len)))-1` for `iv_len>=11`
and that reduces to `(1<<32)-1` for `iv_len==11`.  Left-shifting past
the sign bit and overflowing a signed integral type are both undefined
behaviors.

This commit switches to fixed values and restricts the `iv_len==11`
case to `INT_MAX`, as was already the case for all `iv_len<=10`.

PR-URL: #21462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
targos mentioned this pull request Jul 3, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL