NuLL pointer dererence error when tried calling MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)+188)

36 views
Skip to first unread message

Manisha Sinha

unread,
Jun 20, 2019, 1:57:29 AM6/20/19
to Protocol Buffers
Hello Everyone,

one of my android application was previously using protobuf2.6 and things were working fine. but now the new AOSP contains protobuf3 beta version.

i just generated the pb.cc and pb.h files using the aprotoc compiler without making any changes in my proto files. then linked it against libprotobuf-cpp-full.

The build was fine but my application crashes when i tried calling MergePartialFromCodedStream() in order to decode the data.

please let me know if anyone has any input on this.

Do i need to make any more changes with respect to protobuf3 as the source code from previous AOSP is exactly the same.

code snippet for decoding is as below:

::google::protobuf::io::CodedInputStream input((const ::google::protobuf::uint8*)recvPackage.packageData, analyzedHead.packageDataSize);

protocolVersionMatchStatus.MergePartialFromCodedStream(&input);


Thanks,
Manisha

Adam Cozzette

unread,
Jun 20, 2019, 11:42:59 AM6/20/19
to Manisha Sinha, Protocol Buffers
I would guess that you are still linking against the 2.6 version of libprotobuf, and you have to update the library so that its version matches the protoc version you used.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/77b7a87d-a81d-4f57-b105-84150a20e6a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manisha Sinha

unread,
Jun 24, 2019, 1:56:03 AM6/24/19
to Protocol Buffers
Hello Adam,

Thank you for your input. My AOSP has protbuf-3.0 beta version but the output of protoc --version gives me libprotoc 2.7.0. Is that OK or can it be the probable cause of my issue.

Because what i see is we get libc FATAL error while calling "ReadTagWithCutoff(127)".

Best Regards,
Manisha


On Thursday, June 20, 2019 at 9:12:59 PM UTC+5:30, Adam Cozzette wrote:
I would guess that you are still linking against the 2.6 version of libprotobuf, and you have to update the library so that its version matches the protoc version you used.

On Wed, Jun 19, 2019 at 10:57 PM Manisha Sinha <manishas...@gmail.com> wrote:
Hello Everyone,

one of my android application was previously using protobuf2.6 and things were working fine. but now the new AOSP contains protobuf3 beta version.

i just generated the pb.cc and pb.h files using the aprotoc compiler without making any changes in my proto files. then linked it against libprotobuf-cpp-full.

The build was fine but my application crashes when i tried calling MergePartialFromCodedStream() in order to decode the data.

please let me know if anyone has any input on this.

Do i need to make any more changes with respect to protobuf3 as the source code from previous AOSP is exactly the same.

code snippet for decoding is as below:

::google::protobuf::io::CodedInputStream input((const ::google::protobuf::uint8*)recvPackage.packageData, analyzedHead.packageDataSize);

protocolVersionMatchStatus.MergePartialFromCodedStream(&input);


Thanks,
Manisha

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prot...@googlegroups.com.

Manisha Sinha

unread,
Jun 26, 2019, 4:40:38 AM6/26/19
to Protocol Buffers
Hello All,

I am still struggling with the same problem :

 libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0  just after the call;

::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);


verified that input is not NULL

protoc compiler version is -> libprotoc 3.0
protobuf- 3.0 beta.

Please suggest.

Best Regards,
Manisha

To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.

To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.

Adam Cozzette

unread,
Jun 27, 2019, 1:45:56 PM6/27/19
to Manisha Sinha, Protocol Buffers
I would still guess that something is wrong with the build setup, but I'm not familiar enough with AOSP to say what the problem is. If you need to work with AOSP then I would recommend making sure you build your protos the exact same way AOSP builds its own protos. For example, make sure to use AOSP's protoc (I guess they call their version aprotoc?) and link against AOSP's protobuf libraries. If you use the protoc and protobuf libraries installed on your system then they might be a completely different version from what AOSP needs to use.

Reply all
Reply to author
Forward
0 new messages