[C#] Fix union verifier (#8593)

* [C#] Add test verifying unions

* [C#] Fix verifying unions

---------

Co-authored-by: Björn Harrtell <bjornharrtell@users.noreply.github.com>
Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
This commit is contained in:
TorsteinTenstadNorsonic
2025-08-29 01:05:42 +02:00
committed by GitHub
parent deb3d93454
commit 35230bd70c
2 changed files with 32 additions and 2 deletions

View File

@@ -684,10 +684,10 @@ namespace Google.FlatBuffers
{
return false;
}
// Check union data
offset = GetVOffset(tablePos, valueVOffset);
// Take type id
var typeId = verifier_buffer.Get(Convert.ToInt32(offset));
// Check union data
offset = GetVOffset(tablePos, valueVOffset);
if (offset == 0)
{
// When value data is not present, allow union verification function to deal with illegal offset