Switch string limit check for a sanity check of 1 million bytes #402
+4
−83
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.
Proposed fix for #401 this:
The root cause seems to be that we read invalid memory, and
rstring.lendoesn't contain a string length, but rather, a pointer containing memory address. That memory address is absurdly large and we are expecting the string length, so we fail to alloc while trying to read it.To fix this, i'm:
_limitvariant I added and adding a hardcoded check of 1 million bytes directly toget_ruby_string_3_3_0I suspect the issue is that we are encountering a ruby with different field offsets or sizes than what we were compiled when we ran bindgen, or we are passing it an invalid address. I'm adding the address to the error so we can see if there is any obvious pattern to them (eg, maybe some are VALUE of 0x0f, which is Qnil)