From 69f5660a44ff0f13ba97d5d5c1393d8b13f85bc5 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Mon, 14 Feb 2022 11:48:46 -0800 Subject: [PATCH] Fixed Parser not checking size of union types vector Change-Id: Ibcfc49a9c9376372bd15da2ed3a7f7a298863ccc --- src/idl_parser.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index 7e4cb08fd..47d01f0f0 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -1128,6 +1128,9 @@ CheckedError Parser::ParseAnyValue(Value &val, FieldDef *field, } uint8_t enum_idx; if (vector_of_union_types) { + if (vector_of_union_types->size() <= count) + return Error("union types vector smaller than union values vector" + " for: " + field->name); enum_idx = vector_of_union_types->Get(count); } else { ECHECK(atot(constant.c_str(), *this, &enum_idx));