protobuf
protobuf copied to clipboard
[C++] Segmentation fault when call ParseFromString with bad data
What version of protobuf and what language are you using? Version: v3.12, install by apt in Debian 12 Language: C++
What operating system (Linux, Windows, ...) and version? Debian 12
What runtime / compiler are you using (e.g., python version or gcc version) clang
What did you do? Run this code
int main(int argc, char** args)
{
string v1("1");
TestPackage p;
//if (p.ParsePartialFromString(v1))
if (p.ParseFromString(v1))
{
cout << "succeed" << endl;
}
else
{
cout << "error" << endl;
}
cout << "quit" << endl;
}
What did you expect to see print "error"
What did you see instead?
Segmentation fault
Anything else we should know about your project / environment The proto
syntax = "proto3";
option cc_enable_arenas = false;
package Base;
message TestPackage
{
int32 Function = 1;
fixed64 ID = 2;
}