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

Fix crash in #12104 (cherry-pick) #12726

Merged
merged 1 commit into from
May 9, 2023

Conversation

acozzette
Copy link
Member

This crash was due to the fact that we were passing nullptr as a const char* parameter and relying on that implicitly converting into an empty absl::string_view. absl::string_view supports that functionality, but starting with C++17 its behavior changes since it's just a type alias for std::string_view. std::string_view does not have any special conversion for nullptr and so we were just getting crashes.

PiperOrigin-RevId: 530431663

This crash was due to the fact that we were passing `nullptr` as a `const
char*` parameter and relying on that implicitly converting into an empty
`absl::string_view`. `absl::string_view` supports that functionality, but
starting with C++17 its behavior changes since it's just a type alias for
`std::string_view`. `std::string_view` does not have any special conversion for
nullptr and so we were just getting crashes.

PiperOrigin-RevId: 530431663
@acozzette acozzette requested a review from a team as a code owner May 8, 2023 23:44
@acozzette acozzette requested review from sbenzaquen, mkruskal-google and a team and removed request for a team May 8, 2023 23:44
@acozzette acozzette added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 8, 2023
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label May 8, 2023
@acozzette acozzette merged commit 21b02b2 into protocolbuffers:23.x May 9, 2023
@acozzette acozzette deleted the cherrypick-12104 branch May 9, 2023 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants