Skip to content

debug: Fix crash handling null strings #31523

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed

Conversation

rustyconover
Copy link
Contributor

When internal debug is enabled output null strings as
"(null)" rather than crashing matching glibc's behavior.

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows

When internal debug is enabled output null strings as
"(null)" rather than crashing matching glibc's behavior.
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jan 26, 2020
@rustyconover rustyconover requested a review from addaleax January 26, 2020 15:55
@cjihrig
Copy link
Contributor

cjihrig commented Jan 26, 2020

It's probably worth adding a test for this.

Copy link
Member

@lundibundi lundibundi left a comment

Choose a reason for hiding this comment

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

LGTM.

Could you please add a test case for this one. I think something like
EXPECT_EQ(SPrintF("%s", nullptr), "(null)")); in the SPrintF case of test/cctest/test_util.cc will be enough.

Copy link
Contributor Author

@rustyconover rustyconover left a comment

Choose a reason for hiding this comment

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

Added test

@cjihrig
Copy link
Contributor

cjihrig commented Jan 26, 2020

Still LGTM. Thanks.

Copy link
Member

@lundibundi lundibundi left a comment

Choose a reason for hiding this comment

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

👍

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jan 27, 2020

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 27, 2020
Trott pushed a commit that referenced this pull request Jan 29, 2020
When internal debug is enabled, output null strings as
"(null)" rather than crashing, matching glibc's behavior.

PR-URL: #31523
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@Trott
Copy link
Member

Trott commented Jan 29, 2020

Landed in 32f63fc.

Thanks for the contribution! 🎉

@Trott Trott closed this Jan 29, 2020
codebytere pushed a commit that referenced this pull request Feb 17, 2020
When internal debug is enabled, output null strings as
"(null)" rather than crashing, matching glibc's behavior.

PR-URL: #31523
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@codebytere codebytere mentioned this pull request Feb 17, 2020
codebytere pushed a commit that referenced this pull request Mar 15, 2020
When internal debug is enabled, output null strings as
"(null)" rather than crashing, matching glibc's behavior.

PR-URL: #31523
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
codebytere pushed a commit that referenced this pull request Mar 17, 2020
When internal debug is enabled, output null strings as
"(null)" rather than crashing, matching glibc's behavior.

PR-URL: #31523
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@codebytere codebytere mentioned this pull request Mar 17, 2020
codebytere pushed a commit that referenced this pull request Mar 30, 2020
When internal debug is enabled, output null strings as
"(null)" rather than crashing, matching glibc's behavior.

PR-URL: #31523
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # 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++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants