Re: [protobuf] Segfault when parsing data.
I suspect that your build is mixing your downloaded 3.12.3 protobuf source with a different protobuf version installed by your distro's package manager. I would recommend making sure that your project is only compiling against one version of protobuf. Also, I don't think this is related but you might want to use 3.13.0 or 3.12.4 instead of 3.12.3. We made a mistake with 3.12.3 and published tar.gz files on the GitHub release page that were generated from the wrong Git commit. On Mon, Aug 24, 2020 at 1:56 PM Test Last wrote: > Hi everyone > > I ported a ODBC Driver that works in an RPC fashion from windows to linux. > The port was actually quite trivial since the code was already Cross OS > Friendly. > The protobuf has never been an issue on Windows side. The protobuf package > was V3.12.3 and was also installed by visual studio. > > However when I download Protobuf C++ and compile them on both Ubuntu and > CentOS. And compile my program I get strange errors ALWAYS resulting from > "repeated_field.h. > Sometimes the error is on line 1750 and other times its on 1744 but no > matter what version I compile or what OS I use it just never seems to want > to process anything that needs to use "repeated_field.h" . I will paste my > backtrace and also my ldd of the driver. With the makefile I use to compile > the protobufs. > > This is a backtrace of a string of data that needs to be parsed. This > always breaks. > The class its trying to parse into is -> ExecuteResponse : Please check > the proto files. > This is the backtrace. > > Program received signal SIGSEGV, Segmentation fault. > 0x76369cc4 in > google::protobuf::internal::RepeatedPtrFieldBase::Add::TypeHandler> > (this=0x68e8d0, prototype=0x0) >at /usr/local/include/google/protobuf/repeated_field.h:1744 > 1744 if (rep_ != NULL && current_size_ < rep_->allocated_size) { > (gdb) backtrace > #0 0x76369cc4 in > google::protobuf::internal::RepeatedPtrFieldBase::Add::TypeHandler> > (this=0x68e8d0, prototype=0x0) >at /usr/local/include/google/protobuf/repeated_field.h:1744 > #1 0x76366e39 in > google::protobuf::RepeatedPtrField::Add (this=0x68e8d0) at > /usr/local/include/google/protobuf/repeated_field.h:2195 > #2 0x763646fa in Row::_internal_add_value (this=0x68e8c0) at > common.pb.h:5781 > #3 0x7635697f in Row::_InternalParse (this=0x68e8c0, >ptr=0x67c5f0 "*\n\023\b\025\032\017Alex", '*' , > "\"\023\b\025\032\017Alex", '*' , > "\n,\n\024\b\025\032\020a***oum.br\"\024\b\025\032 > \020a***com.br > \n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\001\n*\n\023\b\025\032\017Edua" > , '*' , "\"\023\b\025\032\017Edua", '*' times>, "\n<\n\034\b\025\032\030e*"..., ctx=0x7fffce30) at > common.pb.cc:3927 > #4 0x76367db6 in > google::protobuf::internal::ParseContext::ParseMessage > (this=0x7fffce30, msg=0x68e8c0, >ptr=0x67c5ef "\n*\n\023\b\025\032\017Alex", '*' , > "\"\023\b\025\032\017Alex", '*' , > "\n,\n\024\b\025\032\020a*com.br\"\024\b\025\0 > 32\020a***oom.br > \n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\001\n*\n\023\b\025\032\017Edu > a", '*' , "\"\023\b\025\032\017Edua", '*' times>, "\n<\n\034\b\025\032\030e"...) at > /usr/local/include/google/protobuf/parse_context.h:614 > #5 0x7635596f in Frame::_InternalParse (this=0x68d830, >ptr=0x67c5ed "\214\001\n*\n\023\b\025\032\017Alex", '*' times>, "\"\023\b\025\032\017Alex", '*' , > "\n,\n\024\b\025\032\020a*l.com.br\"\024 > \b\025\032\020aom.br > \n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\001\n*\n\023\b\025\03 > 2\017Edua", '*' , "\"\023\b\025\032\017Edua", '*' > , "\n<\n\034\b\025\032\030e**"..., ctx=0x7fffce30) at > common.pb.cc:3688 > #6 0x763ac758 in > google::protobuf::internal::ParseContext::ParseMessage > (this=0x7fffce30, msg=0x68d830, >ptr=0x67c5ea "\020\001\032\214\001\n*\n\023\b\025\032\017Alex", '*' > , "\"\023\b\025\032\017Alex", '*' , > "\n,\n\024\b\025\032\020a*l. > com.br\"\024\b\025\032\020al.com.br > \n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\001\n*\n\ > 023\b\025\032\017Edua", '*' , > "\"\023\b\025\032\017Edua", '*' , > "\n<\n\034\b\025\032\030"...) >at /usr/local/include/google/protobuf/parse_context.h:614 > #7 0x76395e79 in ResultSetResponse::_InternalParse > (this=0x674310, >ptr=0x67c5e8 "\215\006\020\001\032\214\001\n*\n\023\b\025\032\017Alex", > '*' , "\"\023\b\025\032\017Alex", '*' , > "\n,\n\024\b\025\032\020a* > **com.br\"\024\b\025\032\020a*om.br > \n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\0 > 01\n*\n\023\b\025\032\017Edua", '*' , >
[protobuf] Segfault when parsing data.
Hi everyone I ported a ODBC Driver that works in an RPC fashion from windows to linux. The port was actually quite trivial since the code was already Cross OS Friendly. The protobuf has never been an issue on Windows side. The protobuf package was V3.12.3 and was also installed by visual studio. However when I download Protobuf C++ and compile them on both Ubuntu and CentOS. And compile my program I get strange errors ALWAYS resulting from "repeated_field.h. Sometimes the error is on line 1750 and other times its on 1744 but no matter what version I compile or what OS I use it just never seems to want to process anything that needs to use "repeated_field.h" . I will paste my backtrace and also my ldd of the driver. With the makefile I use to compile the protobufs. This is a backtrace of a string of data that needs to be parsed. This always breaks. The class its trying to parse into is -> ExecuteResponse : Please check the proto files. This is the backtrace. Program received signal SIGSEGV, Segmentation fault. 0x76369cc4 in google::protobuf::internal::RepeatedPtrFieldBase::Add::TypeHandler> (this=0x68e8d0, prototype=0x0) at /usr/local/include/google/protobuf/repeated_field.h:1744 1744 if (rep_ != NULL && current_size_ < rep_->allocated_size) { (gdb) backtrace #0 0x76369cc4 in google::protobuf::internal::RepeatedPtrFieldBase::Add::TypeHandler> (this=0x68e8d0, prototype=0x0) at /usr/local/include/google/protobuf/repeated_field.h:1744 #1 0x76366e39 in google::protobuf::RepeatedPtrField::Add (this=0x68e8d0) at /usr/local/include/google/protobuf/repeated_field.h:2195 #2 0x763646fa in Row::_internal_add_value (this=0x68e8c0) at common.pb.h:5781 #3 0x7635697f in Row::_InternalParse (this=0x68e8c0, ptr=0x67c5f0 "*\n\023\b\025\032\017Alex", '*' , "\"\023\b\025\032\017Alex", '*' , "\n,\n\024\b\025\032\020a***oum.br\"\024\b\025\032 \020a***com.br\n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\001\n*\n\023\b\025\032\017Edua" , '*' , "\"\023\b\025\032\017Edua", '*' , "\n<\n\034\b\025\032\030e*"..., ctx=0x7fffce30) at common.pb.cc:3927 #4 0x76367db6 in google::protobuf::internal::ParseContext::ParseMessage (this=0x7fffce30, msg=0x68e8c0, ptr=0x67c5ef "\n*\n\023\b\025\032\017Alex", '*' , "\"\023\b\025\032\017Alex", '*' , "\n,\n\024\b\025\032\020a*com.br\"\024\b\025\0 32\020a***oom.br\n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\001\n*\n\023\b\025\032\017Edu a", '*' , "\"\023\b\025\032\017Edua", '*' , "\n<\n\034\b\025\032\030e"...) at /usr/local/include/google/protobuf/parse_context.h:614 #5 0x7635596f in Frame::_InternalParse (this=0x68d830, ptr=0x67c5ed "\214\001\n*\n\023\b\025\032\017Alex", '*' , "\"\023\b\025\032\017Alex", '*' , "\n,\n\024\b\025\032\020a*l.com.br\"\024 \b\025\032\020aom.br\n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\001\n*\n\023\b\025\03 2\017Edua", '*' , "\"\023\b\025\032\017Edua", '*' , "\n<\n\034\b\025\032\030e**"..., ctx=0x7fffce30) at common.pb.cc:3688 #6 0x763ac758 in google::protobuf::internal::ParseContext::ParseMessage (this=0x7fffce30, msg=0x68d830, ptr=0x67c5ea "\020\001\032\214\001\n*\n\023\b\025\032\017Alex", '*' , "\"\023\b\025\032\017Alex", '*' , "\n,\n\024\b\025\032\020a*l. com.br\"\024\b\025\032\020al.com.br\n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\001\n*\n\ 023\b\025\032\017Edua", '*' , "\"\023\b\025\032\017Edua", '*' , "\n<\n\034\b\025\032\030"...) at /usr/local/include/google/protobuf/parse_context.h:614 #7 0x76395e79 in ResultSetResponse::_InternalParse (this=0x674310, ptr=0x67c5e8 "\215\006\020\001\032\214\001\n*\n\023\b\025\032\017Alex", '*' , "\"\023\b\025\032\017Alex", '*' , "\n,\n\024\b\025\032\020a* **com.br\"\024\b\025\032\020a*om.br\n\030\n\n\b\025\032\006Brazil\"\n\b\025\032\006Brazil\n\026\n\t\b\032\032\005\063\067.62\"\t\b\032\032\005\063\067.62\032\234\0 01\n*\n\023\b\025\032\017Edua", '*' , "\"\023\b\025\032\017Edua", '*' , "\n<\n\034\b\025"..., ctx=0x7fffce30) at response.pb.cc:788 #8 0x763aca34 in google::protobuf::internal::ParseContext::ParseMessage (this=0x7fffce30, msg=0x674310, ptr=0x67c4a3 "\n\b0pOR9266\020B\030\001\"\263\002\nJ \001\060\001@\377\001J\bfullnameR\bfullname`\377\001z\005Spark\200\001\001\232\001\020java.lang.String\242\001\f\b\f\022\ 006STRING\030\025\nF\b\001 \001\060\001@\377\001J\005emailR\005email`\377\001z\005Spark\200\001\001\232\001\020java.lang.String\242\001\f\b\f\022\006STRING\030\025\nJ\b\002 \001\ 060\001@\377\001J\acountryR\acountry`\377\001z\005S"...) at