Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ObjectSpace.dump with super() callinfo #8630

Merged
merged 3 commits into from
Oct 12, 2023

Conversation

jhawthorn
Copy link
Member

@jhawthorn jhawthorn commented Oct 11, 2023

super() uses 0 as mid for its callinfo, so we need to check for that to avoid a segfault when using dump_all.

Previously this would crash since #8571

require "objspace"
class Foo
  def foo
    super(bar: 123)
  end
end
ObjectSpace.dump_all(output: :string)

I also switched to using dump_append_string_value even though that's probably not necessary, it removes an assumption about what callinfo mids the parser will generate.

cc @peterzhu2118

super() uses 0 as mid for its callinfo, so we need to check for that to
avoid a segfault when using dump_all.
I don't think it's possible to create a CI with a mid which would need
escaping to be in a JSON string, but I think we might as well not rely
on that assumption.
@casperisfine
Copy link
Contributor

I was just tracking that same crash 5 minutes ago ❤️

@jhawthorn jhawthorn merged commit 1c871c0 into ruby:master Oct 12, 2023
91 of 92 checks passed
casperisfine pushed a commit to Shopify/ruby-definitions that referenced this pull request Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants