Crash in generated code since 3.15 when built with gcc using C++14
What version of protobuf and what language are you using? Version: v3.15, v3.17.3, master Language: C++
What operating system (Linux, Windows, ...) and version? Linux 5.13, glibc 2.34
What runtime / compiler are you using (e.g., python version or gcc version) gcc 11.2
What did you do? Reproducer: protobuf-init.tar.gz
Steps to reproduce the behavior:
- Build reproducer
- Run built
testbinary - Observe crash
What did you expect to see Exit code 0, no crash.
What did you see instead? Segmentation fault in global initialization.
0x00007ffff7d67792 in google::protobuf::internal::ExtensionSet::MutableMessage (this=0x6927d0, number=<optimized out>, type=<optimized out>, prototype=..., descriptor=<optimized out>)
at google/protobuf/extension_set.cc:651
651 extension->message_value = prototype.New(arena_);
(gdb) print &prototype
$1 = (const google::protobuf::MessageLite *) 0x71c880 <google::api::_HttpRule_default_instance_>
(gdb) print prototype
$2 = (const google::protobuf::MessageLite &) @0x657680: {_vptr.MessageLite = 0x0, _internal_metadata_ = {ptr_ = 0, static kUnknownFieldsTagMask = 1, static kMessageOwnedArenaTagMask = 2,
static kPtrTagMask = 3, static kPtrValueMask = -4}}
(gdb) print arena_
$3 = (google::protobuf::Arena *) 0x0
I'm not familiar with global initialization code but it seems google::api::_HttpRule_default_instance_ isn't initialized early enough.
Anything else we should know about your project / environment
This only happens when built with gcc and -std set to C++11 or C++14. I don't see a crash with clang 12 or with gcc using C++17.
protobuf versions before 3.15 are working fine. According to bisect the first bad commit is a00125024e9231d76746bd394fef8876f5cc15e2. Unfortunately, that's just a sync, not a proper commit.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.
This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.