mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-18 09:24:25 +00:00
Fix heap-buffer-overflow if there is a struct within a union
The validator previously did not check if a struct within a union was valid, causing a heap buffer overflow. Add a check to make sure that the struct is valid in this case. Change-Id: I87d41b12fdfc2a99406789531ba92b841c063c76
This commit is contained in:
@@ -547,13 +547,13 @@ inline bool VerifyCharacter(flatbuffers::Verifier &verifier, const void *obj, Ch
|
||||
return verifier.VerifyTable(ptr);
|
||||
}
|
||||
case Character_Rapunzel: {
|
||||
return true;
|
||||
return verifier.Verify<Rapunzel>(static_cast<const uint8_t *>(obj), 0);
|
||||
}
|
||||
case Character_Belle: {
|
||||
return true;
|
||||
return verifier.Verify<BookReader>(static_cast<const uint8_t *>(obj), 0);
|
||||
}
|
||||
case Character_BookFan: {
|
||||
return true;
|
||||
return verifier.Verify<BookReader>(static_cast<const uint8_t *>(obj), 0);
|
||||
}
|
||||
case Character_Other: {
|
||||
auto ptr = reinterpret_cast<const flatbuffers::String *>(obj);
|
||||
|
||||
Reference in New Issue
Block a user