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: fix use of uninitialized variable #9281

Closed
wants to merge 1 commit into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Oct 25, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

src

Description of change

Alternative to #9280 ...
The proposed fix in 9280 breaks the calculation algorithm.

Variable was uninitialized in 72547fe Initialize the variable and add a static_check

/cc @bnoordhuis @addaleax

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Oct 25, 2016
@jasnell
Copy link
Member Author

jasnell commented Oct 25, 2016

@jasnell
Copy link
Member Author

jasnell commented Oct 28, 2016

ping @addaleax @bnoordhuis

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 nit. Does valgrind -q complain without this patch? If no, consider adding a regression test.

@@ -521,7 +521,9 @@ static void GetStringWidth(const FunctionCallbackInfo<Value>& args) {
TwoByteValue value(env->isolate(), args[0]);
// reinterpret_cast is required by windows to compile
UChar* str = reinterpret_cast<UChar*>(*value);
UChar32 c;
static_assert(sizeof(*str) == sizeof(**value),
"(sizeof(*str) == sizeof(**value)");
Copy link
Member

Choose a reason for hiding this comment

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

You have an extraneous paren in the string.

Variable was uninitialized in 72547fe
Initialize the variable and add a static_check
jasnell added a commit that referenced this pull request Oct 28, 2016
Variable was uninitialized in 72547fe
Initialize the variable and add a static_check

PR-URL: #9281
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@jasnell
Copy link
Member Author

jasnell commented Oct 28, 2016

Landed in 2bd850b

@jasnell jasnell closed this Oct 28, 2016
evanlucas pushed a commit that referenced this pull request Nov 3, 2016
Variable was uninitialized in 72547fe
Initialize the variable and add a static_check

PR-URL: #9281
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport

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++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants