We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, I'm not sure exactly what's causing this, but the code below causes an infinite loop.
https://github.com/Cysharp/MemoryPack/blob/main/src/MemoryPack.Core/Compression/BrotliCompressor.cs#L263 while (lastResult == OperationStatus.DestinationTooSmall)
while (lastResult == OperationStatus.DestinationTooSmall)
Case1
var buffer = new ArrayBufferWriter<byte>(); using var state = MemoryPackWriterOptionalStatePool.Rent(null); var writer = new MemoryPackWriter<ArrayBufferWriter<byte>>(ref buffer, state); var compressor = new BrotliCompressor(CompressionLevel.Fastest, 22); var coWriter = new MemoryPackWriter<BrotliCompressor>(ref compressor, writer.OptionalState); // no write to coWriter compressor.CopyTo(ref writer);
Case2 In this, an infinite loop occurs. (BrotliEncoderOperation.Finish) https://github.com/Cysharp/MemoryPack/blob/main/src/MemoryPack.Core/Compression/BrotliCompressor.cs#L217
using var state = MemoryPackWriterOptionalStatePool.Rent(null); var buffer = new ArrayBufferWriter<byte>(); // ArrayBufferWriter.DefaultInitialBufferSize: 256 var writer = new MemoryPackWriter<ArrayBufferWriter<byte>>(ref buffer, state); var compressor = new BrotliCompressor(CompressionLevel.Fastest, 22); var coWriter = new MemoryPackWriter<BrotliCompressor>(ref compressor, writer.OptionalState); var bytes = new byte[248]; // 'bytes' length is 248. Random.Shared.NextBytes(bytes); coWriter.WriteUnmanagedSpan(bytes.AsSpan()); coWriter.Flush(); compressor.CopyTo(ref writer);
Case3 In this, an infinite loop occurs. (not final block) https://github.com/Cysharp/MemoryPack/blob/main/src/MemoryPack.Core/Compression/BrotliCompressor.cs#L212
using var state = MemoryPackWriterOptionalStatePool.Rent(null); var buffer = new ArrayBufferWriter<byte>(); // ArrayBufferWriter.DefaultInitialBufferSize is 256 var writer = new MemoryPackWriter<ArrayBufferWriter<byte>>(ref buffer, state); var compressor = new BrotliCompressor(CompressionLevel.Fastest, 22); var coWriter = new MemoryPackWriter<BrotliCompressor>(ref compressor, writer.OptionalState); var bytes = new byte[249]; // 'bytes' length is 249. Random.Shared.NextBytes(bytes); coWriter.WriteUnmanagedSpan(bytes.AsSpan()); coWriter.Flush(); compressor.CopyTo(ref writer);
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Hello,
I'm not sure exactly what's causing this, but the code below causes an infinite loop.
https://github.com/Cysharp/MemoryPack/blob/main/src/MemoryPack.Core/Compression/BrotliCompressor.cs#L263
while (lastResult == OperationStatus.DestinationTooSmall)
Case1
Case2
In this, an infinite loop occurs. (BrotliEncoderOperation.Finish)
https://github.com/Cysharp/MemoryPack/blob/main/src/MemoryPack.Core/Compression/BrotliCompressor.cs#L217
Case3
In this, an infinite loop occurs. (not final block)
https://github.com/Cysharp/MemoryPack/blob/main/src/MemoryPack.Core/Compression/BrotliCompressor.cs#L212
The text was updated successfully, but these errors were encountered: