Skip to content

Conversation

@dalehamel
Copy link
Contributor

@dalehamel dalehamel commented Oct 8, 2025

Proposed fix for #401 this:

The root cause seems to be that we read invalid memory, and rstring.len doesn'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:

  • Removes the _limit variant I added and adding a hardcoded check of 1 million bytes directly to get_ruby_string_3_3_0
  • Removes the ruby string array read that I added which uses this limit variant

I 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)

@dalehamel
Copy link
Contributor Author

@acj this should address what we discussed in #401

Copy link
Member

@acj acj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@acj acj merged commit 0ad3010 into rbspy:main Oct 9, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants