Fix bug with empty strings in repeated string callbacks.

Fix suggested by Henrik Carlgren. Added also unit test for the bug.

Update issue 73
Status: FixedInGit
This commit is contained in:
Petteri Aimonen
2013-04-14 09:26:42 +03:00
parent 6a02298584
commit 9939910833
4 changed files with 23 additions and 2 deletions

View File

@@ -430,11 +430,11 @@ static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type
if (!pb_make_string_substream(stream, &substream))
return false;
while (substream.bytes_left)
do
{
if (!pCallback->funcs.decode(&substream, iter->pos, arg))
PB_RETURN_ERROR(stream, "callback failed");
}
} while (substream.bytes_left);
pb_close_string_substream(stream, &substream);
return true;