Skip to content

debug: Fix crash handling null strings - #31523

Closed
rustyconover wants to merge 2 commits into
nodejs:masterfrom
rustyconover:fix-debug-null-string-pointer
Closed

debug: Fix crash handling null strings#31523
rustyconover wants to merge 2 commits into
nodejs:masterfrom
rustyconover:fix-debug-null-string-pointer

Conversation

@rustyconover

Copy link
Copy Markdown
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-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jan 26, 2020
@cjihrig

Copy link
Copy Markdown
Contributor

It's probably worth adding a test for this.

@lundibundilundibundi left a comment

Copy link
Copy Markdown
Member

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.

Comment threadsrc/debug_utils-inl.h Outdated

@rustyconoverrustyconover left a comment

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Contributor

Still LGTM. Thanks.

@lundibundilundibundi left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

nodejs-github-bot commented Jan 27, 2020

Copy link
Copy Markdown
Collaborator

@TrottTrott 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
Copy Markdown
Member

Landed in 32f63fc.

Thanks for the contribution! 🎉

@TrottTrott 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>
@codebyterecodebytere 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>
@codebyterecodebytere 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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs 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

@rustyconover@cjihrig@nodejs-github-bot@Trott@jasnell@addaleax@richardlau@lundibundi