From 6c772817cafb6f45f446fef70746a89c8dfdfd47 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Wed, 30 Jan 2019 14:26:31 +0200 Subject: Fix encoding of fixed size arrays inside proto3 submessages (#376) --- pb_encode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pb_encode.c b/pb_encode.c index d0129e6..78a3fdb 100644 --- a/pb_encode.c +++ b/pb_encode.c @@ -225,7 +225,10 @@ static bool pb_check_proto3_default_value(const pb_field_t *field, const void *p else if (PB_HTYPE(type) == PB_HTYPE_REPEATED) { /* Repeated fields inside proto3 submessage: present if count != 0 */ - return *(const pb_size_t*)pSize == 0; + if (field->size_offset != 0) + return *(const pb_size_t*)pSize == 0; + else + return false; /* Fixed length array */ } else if (PB_HTYPE(type) == PB_HTYPE_ONEOF) { -- cgit v1.2.3