GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: fix UB in computing max message size by bnoordhuis · Pull Request #21462 · nodejs/node

Conversation

@bnoordhuis

@bnoordhuis bnoordhuis commented Jun 22, 2018

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ChALkeR reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bnoordhuis
bnoordhuis requested a review from tniessen June 22, 2018 11:11
@nodejs-github-bot

nodejs-github-bot commented Jun 22, 2018

Copy link
Copy Markdown
Collaborator

@bnoordhuis build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/120/pipeline

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot 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
cjihrig
cjihrig approved these changes Jun 22, 2018
View reviewed changes
tniessen
tniessen approved these changes Jun 22, 2018
View reviewed changes
jasnell
jasnell approved these changes Jun 22, 2018
View reviewed changes
@bnoordhuis bnoordhuis mentioned this pull request Jun 25, 2018
crypto: add support for OCB mode for AEAD #21447
Closed
4 tasks done
@bnoordhuis bnoordhuis closed this Jun 25, 2018
@bnoordhuis
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
@bnoordhuis
crypto: fix UB in computing max message size
19fe529
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
@bnoordhuis
bnoordhuis deleted the fix-crypto-auth-iv-ub branch June 25, 2018 21:46
@bnoordhuis

bnoordhuis commented Jun 25, 2018

Copy link
Copy Markdown
Member Author

Landed in 19fe529.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos pushed a commit that referenced this pull request Jun 26, 2018
@bnoordhuis @targos
crypto: fix UB in computing max message size
45a8376
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
@targos targos mentioned this pull request Jul 3, 2018
v10.6.0 proposal #21629
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@cjihrig cjihrig cjihrig approved these changes
@tniessen tniessen tniessen approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

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

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@bnoordhuis @nodejs-github-bot @jasnell @cjihrig @tniessen
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.