Fixed Parser not checking size of union types vector

Change-Id: Ibcfc49a9c9376372bd15da2ed3a7f7a298863ccc
This commit is contained in:
Wouter van Oortmerssen
2022-02-14 11:48:46 -08:00
parent d5add9fca5
commit 69f5660a44

View File

@@ -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));