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

src: prevent crash in TTYWrap::Initialize #26832

Closed
wants to merge 1 commit into from
Closed

src: prevent crash in TTYWrap::Initialize #26832

wants to merge 1 commit into from

Conversation

Hakerh400
Copy link
Contributor

@Hakerh400 Hakerh400 commented Mar 21, 2019

When console.log is called for the first time it initializes
TTYWrap object. However, if there is not enough space on the
V8 stack, creating function template fails and triggers
empty maybe local exception.

Fixes #26829

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. tty Issues and PRs related to the tty subsystem. labels Mar 21, 2019
src/tty_wrap.cc Outdated Show resolved Hide resolved
@joyeecheung
Copy link
Member

BTW, Environment::SetMethod() and Environment::SetMethodNoSideEffect() also does ToLocalChecked() on the maybe returned by FunctionTemplate::GetFunction() and also does FromJust() on the Maybe returned by Object::Set(), I wonder why this only crashes in the non-heplers here.

@joyeecheung
Copy link
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/21822/ (though it's rather flaky now)

test/parallel/test-ttywrap-stack.js Outdated Show resolved Hide resolved
@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 25, 2019
Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

LGTM with a suggestion.

src/tty_wrap.cc Outdated Show resolved Hide resolved
When console.log is called for the first time it initializes
TTYWrap object. However, if there is not enough space on the
V8 stack, creating function template fails and triggers
empty maybe local exception.
@Hakerh400
Copy link
Contributor Author

CI was failing due to flaky test-worker-prof and the last run timed out for some reason. The failure seems unrelated to this PR.

@nodejs-github-bot
Copy link
Collaborator

BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Apr 4, 2019
When console.log is called for the first time it initializes
TTYWrap object. However, if there is not enough space on the
V8 stack, creating function template fails and triggers
empty maybe local exception.

PR-URL: nodejs#26832
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@BridgeAR
Copy link
Member

BridgeAR commented Apr 4, 2019

Landed in 6fb32ac 🎉

@BridgeAR BridgeAR closed this Apr 4, 2019
@Hakerh400 Hakerh400 deleted the tty branch April 4, 2019 17:15
BethGriggs pushed a commit that referenced this pull request Apr 9, 2019
When console.log is called for the first time it initializes
TTYWrap object. However, if there is not enough space on the
V8 stack, creating function template fails and triggers
empty maybe local exception.

PR-URL: #26832
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Signed-off-by: Beth Griggs <[email protected]>
@BethGriggs BethGriggs mentioned this pull request Apr 9, 2019
BethGriggs pushed a commit that referenced this pull request Apr 10, 2019
When console.log is called for the first time it initializes
TTYWrap object. However, if there is not enough space on the
V8 stack, creating function template fails and triggers
empty maybe local exception.

PR-URL: #26832
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Signed-off-by: Beth Griggs <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. tty Issues and PRs related to the tty subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants