Skip to content

Commit dc037fb

Browse files
🩹 Ensure invalid root type for initial context buffer rental
1 parent 214b01c commit dc037fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lite3DotNet/Lite3Context.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public static Lite3Context Create(int initialCapacity = Lite3Buffer.MinBufferSiz
2525

2626
var buffer = arrayPool.Rent(initialCapacity);
2727

28-
buffer.AsSpan().Clear();
28+
// Ensure that at least the root type tag is invalid
29+
buffer[0] = (byte)Lite3Core.ValueKind.Invalid;
2930

3031
return new Lite3Context(buffer, position: 0, isRentedBuffer: true, arrayPool);
3132
}

0 commit comments

Comments
 (0)