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) #12725

Merged

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 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
@mkruskal-google mkruskal-google merged commit 74b12eb into protocolbuffers:22.x May 9, 2023
@acozzette acozzette deleted the cherrypick-12104-fix branch May 9, 2023 16:05
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