leejw51 / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
0 stars 0 forks source link

ProtoWriter.EndSubItem does not correctly end byte sequence for length #110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The current code never writes 0 to the last bit for the last byte in the
sequence.

do
{
   blob[value++] = (byte)((tmp & 0x7F) | 0x80);
} while ((tmp >>= 7) != 0);

Adding the following line after the above fixes the problem:

blob[value - 1] = (byte)(blob[value - 1] & ~0x80);

Nikita

Original issue reported on code.google.com by nikita.kalashnikov@gmail.com on 25 May 2010 at 9:25

GoogleCodeExporter commented 9 years ago
Thanks; I'll get that merged ASAP.

Original comment by marc.gravell on 26 May 2010 at 4:55

GoogleCodeExporter commented 9 years ago
Awesome, thanks Marc.

Original comment by nikita.kalashnikov@gmail.com on 26 May 2010 at 4:58

GoogleCodeExporter commented 9 years ago
Included in r335 - you were absolutely correct (this also fixed 2 
non-conformances in 
the unit-test suite). Thanks.

Original comment by marc.gravell on 29 May 2010 at 8:28

GoogleCodeExporter commented 9 years ago
Thank you Marc.

Original comment by nikita.kalashnikov@gmail.com on 2 Jun 2010 at 7:47

GoogleCodeExporter commented 9 years ago

Original comment by marc.gravell on 3 Jun 2010 at 6:50