Repository navigation
Conversation
- msgpack_zbuffer_init(zbuf, level, 0) stored 0, so the first write made a zero-size buffer and failed, and the next realloc(ptr, 0) freed it while zbuf->data kept the pointer, which destroy then freed again (msgpack#1198). 0 now means the default size, as in msgpack_vrefbuffer_init(). - msgpack_zbuffer_expand() doubled the size without an overflow check (msgpack#1199). It now fails instead. - msgpack_zbuffer_write() cast len to the 32-bit avail_in, so a write of 4 GiB or more compressed only (len mod 2^32) bytes and returned 0. Long writes now go to zlib in several steps. - expand also cast the free space to the 32-bit avail_out. At exactly 4 GiB free that is 0, so write failed and flush spun forever once the output reached 4 GiB. It now saturates. Fixes msgpack#1198 Fixes msgpack#1199
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## c_master #1205 +/- ##
============================================
+ Coverage 57.47% 62.33% +4.86%
============================================
Files 10 10
Lines 1124 1147 +23
Branches 129 140 +11
============================================
+ Hits 646 715 +69
+ Misses 478 432 -46 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1198, fixes #1199, and two more size problems in the same functions:
msgpack_zbuffer_init(zbuf, level, 0)stored 0, so the first write made a zero-size buffer and failed, and the nextrealloc(ptr, 0)freed it whilezbuf->datakept the pointer, which destroy then freed again. 0 now means the default, as inmsgpack_vrefbuffer_init().msgpack_zbuffer_expand()doubled the size with no overflow check. It now returns false.msgpack_zbuffer_write()castlento the 32-bitavail_in, so a write of 4 GiB + 1 bytes compressed 1 byte and returned 0. Long writes now go to zlib in several steps.expandcast the free space to the 32-bitavail_out. At exactly 4 GiB free that is 0, so write fails and flush spins forever once the output reaches 4 GiB. It now saturates.zbuffer_sizes_cgets its own translation unit with a stand-indeflate()that only counts input, so the tests don't need 4 GiB of data. The size tests fail without the header change (theexpandone on both 32-bit and 64-bit) and pass with it.