summaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-07-31 19:12:57 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-07-31 19:12:57 +0300
commitb582bc9bf699ee76f8634c3c7b7aa1ec0a0afb08 (patch)
tree0be80864aacd99a8c6abeffe734d7cc86f1fd0b1 /pb_decode.c
parent5703ad0c55634e91157a965bbfa089a4396f3cb5 (diff)
Fix bug in decoder with packed arrays.
Update issue 23 Status: FixedInGit
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 18941cbe..6d3a0b6c 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -288,6 +288,7 @@ static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_t
&& PB_LTYPE(iter->current->type) <= PB_LTYPE_LAST_PACKABLE)
{
/* Packed array */
+ bool status;
size_t *size = (size_t*)iter->pSize;
pb_istream_t substream;
if (!make_string_substream(stream, &substream))
@@ -300,7 +301,9 @@ static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_t
return false;
(*size)++;
}
- return (substream.bytes_left == 0);
+ status = (substream.bytes_left == 0);
+ stream->state = substream.state;
+ return status;
}
else
{