From 41506406506332675016916280693a8d94e1b3ac Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Wed, 17 Feb 2016 12:37:32 -0800 Subject: Added assertions for getjsonname() return. --- upb/json/parser.rl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'upb/json/parser.rl') diff --git a/upb/json/parser.rl b/upb/json/parser.rl index 4ccca6c..fbc2d88 100644 --- a/upb/json/parser.rl +++ b/upb/json/parser.rl @@ -1364,9 +1364,11 @@ static void add_jsonname_table(upb_json_parsermethod *m, const upb_msgdef* md) { const upb_fielddef *f = upb_msg_iter_field(&i); size_t field_len = upb_fielddef_getjsonname(f, buf, len); if (field_len > len) { + size_t len2; buf = realloc(buf, field_len); len = field_len; - upb_fielddef_getjsonname(f, buf, len); + len2 = upb_fielddef_getjsonname(f, buf, len); + UPB_ASSERT_VAR(len2, len == len2); } upb_strtable_insert(t, buf, upb_value_constptr(f)); -- cgit v1.2.3