Allow false autorelease to set unmanaged = true#6331
Merged
headius merged 1 commit intojruby:jruby-9.2from Jul 16, 2020
Merged
Conversation
This appears to be long-broken logic for setting autorelease to false, since the only value that will change the unmanaged bit is passing autorelease = true. The change here allows toggling both ways. This may not have been seen before because this version of MemoryIO is only used when the requested size is greater than 256 bytes, and typically structs are smaller than that. In jruby#6284, as well as jruby#6310 and sass/sassc-ruby#208, we have reports of a double free, and sassc itself uses autorelease on a potentially large value here: https://github.com/sass/sassc-ruby/blob/4bd764f568ad312a78181d7a3187f3715388e33e/lib/sassc/native.rb#L54-L58
This was referenced Jul 16, 2020
This was
linked to
issues
Jul 16, 2020
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.
This appears to be long-broken logic for setting autorelease to false, since the only value that will change the unmanaged bit is passing autorelease = true. The change here allows toggling both ways.
This may not have been seen before because this version of MemoryIO is only used when the requested size is greater than 256 bytes, and typically structs are smaller than that. In #6284, as well as #6310 and sass/sassc-ruby#208, we have reports of a double free, and sassc itself uses autorelease on a potentially large value here:
https://github.com/sass/sassc-ruby/blob/4bd764f568ad312a78181d7a3187f3715388e33e/lib/sassc/native.rb#L54-L58