msgpack-java
msgpack-java copied to clipboard
Fixed UnpackerConfig.bufferSize to work
This will Resolve #657
It limits internal buffer size when unpacking Array and Map. However, I think the default bufferSize of 8192 is too small. I changed the default buffer size to 100MiB following msgpack-python.
Buffer size limits now work, but some tests no longer pass. Should I change the Unpacker buffer size used for this test in the settings?
- val unpacker = MessagePack.newDefaultUnpacker(new InputStreamBufferInput(new ByteArrayInputStream(out.toByteArray)))
+ val unpacker = new MessagePack.UnpackerConfig().withBufferSize(16 * 1024).newUnpacker(new InputStreamBufferInput(new ByteArrayInputStream(out.toByteArray)))
Upon re-reading the PR, I noticed some misunderstandings.
UnpackerConfig.bufferSize is used to control the internal buffer size, but it is not meant to limit the size of the uncompressed data. In order to prevent loading excessively large data into memory, we need to introduce another configuration.
I will close this pull request because it has become outdated. The requirement to limit the uncompressed data size and fail the Unpacker is still valid, but it should be addressed in a different context.