Status: New
Labels: Type-Defect Priority-Medium

New issue 655 by String corruption

I am seeing an issue with string corruption under very specific circumstances.

My Proto file:

message MyMessage
   required int32 field1 = 1;
   enum MyEnum
      ENUM_0 = 0;
      ENUM_1 = 1;
      ENUM_2 = 2;
      ENUM_3 = 3;
   optional MyEnum field2 = 2;
   optional string field3 = 3;
   optional string field4 = 4;
   optional string field5 = 5;
   optional string field6 = 6;
   optional string field7 = 7;
   optional string field8 = 8;
   optional string field9 = 9;
   message MySubMessage
      required float field1 = 1;
      required string field2 = 2;
   repeated MySubMessage field10 = 10;

I fill in the message with the following values:
field1 = 1
field2 = ENUM_3
field3 = "ccccccccbaaaaaa"
field4 = "ccccccccbaaaaaab"
field5 = "ccccccccbaaaaaa"
field6 = "ccccccccbaaaaaab"
field7 = "ccccccccbaaaaa"
field8 = "ccccccccbaaaaaabbbb"
field9 = "ddddd"
field10.field1 = 0.91629
field10.field2 = "aaabcccccc"

All of the strings are set using the char* setter. I check the values after adding them and they look good. I then serialize the message and call ParseFromArray to de-serialize.

When I check the values, field3 has been corrupted and comes out as "▒ckk".

If i change the length of field3 to be one more or one less character it works fine. I went down the list of subsequent string fields and tried changing the length of each and it appears to solve the problem as well.

I am using protobuf 2.5 with GCC and running on QNX 6.4.1

You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:

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 post to this group, send email to
Visit this group at
For more options, visit

Reply via email to