Skip to content

Commit 1e6372b

Browse files
committed
Growing size when seeking in-memory file beyond bounds
1 parent 902c8a5 commit 1e6372b

File tree

1 file changed

+2
-2
lines changed
  • Wazzy/WasiSnapshotPreview1/FileSystem/Implementations/VirtualFileSystem/Files

1 file changed

+2
-2
lines changed

Wazzy/WasiSnapshotPreview1/FileSystem/Implementations/VirtualFileSystem/Files/InMemoryFile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public override ulong Position
1515
get => (ulong)_position;
1616
set
1717
{
18+
// Grow to ensure we can seek to this position
1819
if (value > Size)
19-
throw new InvalidOperationException("Position cannot be beyond the end of the file");
20-
20+
File._memory.SetLength((long)value);
2121
_position = (long)value;
2222
}
2323
}

0 commit comments

Comments
 (0)