projects
/
platform
/
upstream
/
flatbuffers.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a20e71a
)
reflection: check for valid union enum value during object verification (#5475)
author
Mark Nauwelaerts
<mnauw@users.sourceforge.net>
Mon, 19 Aug 2019 19:48:25 +0000
(21:48 +0200)
committer
Wouter van Oortmerssen
<aardappel@gmail.com>
Mon, 19 Aug 2019 19:48:25 +0000
(12:48 -0700)
... to avoid assertion failure or invalid access due to invalid vector index
src/reflection.cpp
patch
|
blob
|
history
diff --git
a/src/reflection.cpp
b/src/reflection.cpp
index
89ce783
..
5055959
100644
(file)
--- a/
src/reflection.cpp
+++ b/
src/reflection.cpp
@@
-656,6
+656,7
@@
bool VerifyObject(flatbuffers::Verifier &v, const reflection::Schema &schema,
if (utype != 0) {
// Means we have this union field present
auto fb_enum = schema.enums()->Get(field_def->type()->index());
+ if (utype >= fb_enum->values()->size()) return false;
auto child_obj = fb_enum->values()->Get(utype)->object();
if (!VerifyObject(v, schema, *child_obj,
flatbuffers::GetFieldT(*table, *field_def),