From: "alanwu (Alan Wu) via ruby-core" Date: 2026-11-17T17:00:45+00:00 Subject: [ruby-core:127562] [Ruby Bug#22562] Type confusion SEGV: Using `super`, `instance_exec`, and `bind_call`, it is possible to run Array#first method on an instance of Integer Issue #22562 has been reported by alanwu (Alan Wu). ---------------------------------------- Bug #22562: Type confusion SEGV: Using `super`, `instance_exec`, and `bind_call`, it is possible to run Array#first method on an instance of Integer https://bugs.ruby-lang.org/issues/22562 * Author: alanwu (Alan Wu) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- The following crashes 3.3.0 through current trunk (commit:caf4f279d1): ```ruby module M # fixnum: (0x6f56<<1)+1 = 0xdead def first = 0x6f56.instance_exec { super } end M.instance_method(:first).bind_call([]) # :132: [BUG] Segmentation fault at 0x000000000000dead ``` Generally, the body of methods don't type-check `self`, relying on method dispatch to uphold the is-a relationship between `self` and the class/module defining the method. This funky use of `super` breaks that invariant. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/