Add bounds checking to a method where it was missing (#8673)

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:
Curt Hagenlocher
2025-08-28 16:06:03 -07:00
committed by GitHub
parent 35230bd70c
commit a6b337f803

View File

@@ -693,6 +693,7 @@ namespace Google.FlatBuffers
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public unsafe string GetStringUTF8(int startPos, int len)
{
AssertOffsetAndLength(startPos, len);
fixed (byte* buffer = &MemoryMarshal.GetReference(_buffer.ReadOnlySpan.Slice(startPos)))
{
return Encoding.UTF8.GetString(buffer, len);