You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The key problem is that the libprotobuf and the protobuf generated code are built by different compilers. In the first case, libprotobuf is built by MSVC and the generated code by clang-cl 19. In the second case, libprotobuf is built by an older version of clang and the generated code by a newer version.
In both cases, the compiler for the generated code has support for __is_bitwise_cloneable, and therefore EnableCustomNew is true. The generated code then creates MessageCreator with func == nullptr (here).. But the library is built by a compiler without such functionality, and because of that, this is always true, and it blindly dereferences a null pointer func even though tag is not kFunc, causing SIGSEGV.
What did you expect to see
Library and generated code can be built by different compilers and linked together as long as they are ABI compatible.
Although inside Google everything is always built together by the same compiler, the outside world expects differently. In the world outside Google, libprotobuf is usually provided by a package manager rather than built together as the consumer source code, so compiler version match is widely present.
What did you see instead?
When the generated code is built by a newer version of compiler, the linked binary may crash with SIGSEGV.
Anything else we should know about your project / environment
The text was updated successfully, but these errors were encountered:
What version of protobuf and what language are you using?
Version: main
Language: C++
What operating system (Linux, Windows, ...) and version?
Windows & Mac
What runtime / compiler are you using (e.g., python version or gcc version)
clang
What did you do?
Several related:
The key problem is that the libprotobuf and the protobuf generated code are built by different compilers. In the first case, libprotobuf is built by MSVC and the generated code by clang-cl 19. In the second case, libprotobuf is built by an older version of clang and the generated code by a newer version.
In both cases, the compiler for the generated code has support for
__is_bitwise_cloneable
, and therefore EnableCustomNew is true. The generated code then creates MessageCreator with func == nullptr (here).. But the library is built by a compiler without such functionality, and because of that, this is always true, and it blindly dereferences a null pointerfunc
even though tag is notkFunc
, causing SIGSEGV.What did you expect to see
Library and generated code can be built by different compilers and linked together as long as they are ABI compatible.
Although inside Google everything is always built together by the same compiler, the outside world expects differently. In the world outside Google,
libprotobuf
is usually provided by a package manager rather than built together as the consumer source code, so compiler version match is widely present.What did you see instead?
When the generated code is built by a newer version of compiler, the linked binary may crash with SIGSEGV.
Anything else we should know about your project / environment
The text was updated successfully, but these errors were encountered: