1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:17:27 +08:00
osu-lazer/osu.Game/IO
Bartłomiej Dach e57d7d1205
Fix MemoryStreamArchiveReader.GetStream() failing in some cases
`MemoryStreamArchiveReader` introduced in
0657b55196 would previously use
`MemoryStream.GetBuffer()` to retrieve the underlying byte buffer with
stream data. However, this is not generally the method you would want,
for two reasons:

1. It can fail if the stream wasn't created in the way that supports it.
2. As per

	https://learn.microsoft.com/en-us/dotnet/api/system.io.memorystream.getbuffer?view=net-7.0#system-io-memorystream-getbuffer,

   it will return the _raw_ contents of the buffer, including
   potentially unused bytes.

To fix, use `MemoryStream.ToArray()` instead, which avoids both
pitfalls. Notably, `ToArray()` always returns the full contents of the
buffer, regardless of `Position`, as documented in:

    https://learn.microsoft.com/en-us/dotnet/api/system.io.memorystream.toarray?view=net-7.0#system-io-memorystream-toarray
2023-09-18 11:50:36 +02:00
..
Archives Fix MemoryStreamArchiveReader.GetStream() failing in some cases 2023-09-18 11:50:36 +02:00
FileAbstraction Automated pass 2023-06-24 01:00:03 +09:00
Legacy Automated pass 2023-06-24 01:00:03 +09:00
Serialization Automated pass 2023-06-24 01:00:03 +09:00
FileInfo.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
HardLinkHelper.cs Also support hard links on macOS 2022-12-29 22:35:13 +08:00
IFileInfo.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
IStorageResourceProvider.cs Fix missing DummyRenderer in skin resources tests 2022-08-08 13:06:01 +09:00
LineBufferedReader.cs Fix crash on mobile releases when attempting to read any file 2022-07-09 06:01:22 +09:00
MigratableStorage.cs Change migration logic to ignore realm pipe files regardless of database filename 2022-08-03 17:37:30 +09:00
OsuStorage.cs Manual fixes to reduce warnings to zero 2023-06-24 01:52:53 +09:00
StableStorage.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00
WrappedStorage.cs Automated #nullable processing 2022-06-17 16:37:17 +09:00