Project

General

Profile

Actions

Bug #1205

closed

SET_STACK_END crashes due to uninitialized ruby_current_thread

Added by hsugawar (hiro sugawara) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9.1-p0
Backport:
[ruby-core:22439]

Description

=begin
I ported ruby-1.9.1-p0 to Android. It built fine with a few patches and a custom Android.mk with a target of "miniruby."

The executable crashed at an early stage. I succeeded in tracing the crash to a null pointer reference to ruby_current_thread in SET_STACK_END (through GET_THREAD()) called in ruby_get_stack_grow_direction() called in STACK_UPPER() called in ruby_init_stack() called in Init_stack().

Reversing the calling order of Init_BareVM() and Init_stack in eval.c:ruby_init() seems to fix the problem.

Am I right?

Thanks,
hiro

ruby-1.9.1-p0/eval.c ====


*** 56,63 ****

   rb_origenviron = environ;

   Init_stack((void *)&state);

! Init_BareVM();
Init_heap();

   PUSH_TAG();

--- 56,64 ----

   rb_origenviron = environ;
  • Init_BareVM();
    Init_stack((void *)&state);
    

! //Init_BareVM();
Init_heap();

   PUSH_TAG();

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0