If I declare a field as:
optional bytes iv=3 [(nanopb).max_size = 16];
the pb_encode() function does not take the size member of the
pb_bytes_array_t struct into account when
it updates the pData pointer on line 155-158 in pb_encode.c
It is caused by the pb_generator.py line 241-242
elif self.htype != 'PB_HTYPE_CALLBACK' and not self.is_pointer and
self.ltype == 'PB_LTYPE_BYTES':
result += '\n pb_membersize(%s, bytes),' % self.ctype
only measuring the size of the bytes array and not including the size member.
I have solved this temporarily by updating the generated field
descriptor manually to measure the
size of the whole pb_bytes_array_t struct but I am not sure it has
other side effects...
Original issue reported on code.google.com by Petteri.Aimonen on 12 Jan 2012 at 9:56
Original issue reported on code.google.com by
Petteri.Aimonen
on 12 Jan 2012 at 9:56