Fix bug with decoding empty message types. Add test for the same.

Note: the bug only applies to empty message types. Empty messages
of non-empty message types are not affected.

Update issue 65
Status: FixedInGit
This commit is contained in:
Petteri Aimonen
2013-03-09 12:35:07 +02:00
parent 5522e02133
commit d2e3c1ad93
4 changed files with 13 additions and 1 deletions

View File

@@ -571,7 +571,7 @@ bool checkreturn pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[
} while (pb_field_next(&iter));
/* Fixup if last field was also required. */
if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED)
if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED && iter.current->tag)
req_field_count++;
/* Check the whole bytes */