From e1b8a555f30d77a3c0094cf3678666b38f4b4bd3 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Sat, 9 Mar 2013 13:12:09 +0200 Subject: [PATCH] Fix additional bug with empty message types. pb_field_next() would access past the fields array. --- pb_decode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pb_decode.c b/pb_decode.c index e2e89a0..fba8f64 100644 --- a/pb_decode.c +++ b/pb_decode.c @@ -312,6 +312,9 @@ static bool pb_field_next(pb_field_iterator_t *iter) if (PB_HTYPE(iter->current->type) == PB_HTYPE_REQUIRED) iter->required_field_index++; + if (iter->current->tag == 0) + return false; /* Only happens with empty message types */ + iter->current++; iter->field_index++; if (iter->current->tag == 0) -- 2.16.6