Bugs: Browse | Submit New | Admin

[#14028] rb_eval_string_protect crashes in Ruby 1.9

Date:
2007-09-18 02:36
Priority:
3
Submitted By:
Sean O'Neil (s_p_oneil)
Assigned To:
Yukihiro Matsumoto (matz)
Category:
Language / Runtime / Core Libraries
State:
Open
Platform:
 
Summary:
rb_eval_string_protect crashes in Ruby 1.9

Detailed description
#include "ruby.h"
int main(int argc, char **argv)
{
  int state = 0;
  NtInitialize(&argc, &argv);
  RUBY_INIT_STACK;
  ruby_init();
  ruby_script("embedded");
  rb_eval_string_protect("puts 'Hello World'", &state);
  return 0;
}

This works perfectly in Ruby 1.8, but crashes in Ruby 1.9 inside
rb_eval_string_protect. It crashes on line 1703 in eval.c (using the
latest source from svn as of today, or 2007/09/17):

  rb_control_frame_t *cfp = vm_get_ruby_level_cfp(th, th->cfp);
  th->base_block = RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp);
  th->base_block->iseq = cfp->iseq; // Crashes here because cfp is NULL

The problem is caused by vm_get_ruby_level_cfp() returning NULL. That
function passes once through its loop, but
RUBY_VM_NORMAL_ISEQ_P(cfp->iseq) is returning false. it works fine if I load/run a file.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-11-08 01:11
Sender: Roger Pack

If this is still a concern then could you submit a new copy to
the new tracker:
http://redmine.ruby-lang.org/
--this tracker is being shelved.
Thanks!
-=R
Date: 2007-11-18 12:41
Sender: Sean O'Neil

On a similar note, please remove all checks from 1.9 that
keep you from calling it from other threads. Anyone using
threads in C/C++ knows how to synchronize their calls, and
forcing that limitation on them is a major handicap,
especially when Ruby itself doesn't support threads. I'm not
positive, but I also suspect that checks like that are the
primary reason that Ruby is 3-4 times slower in Windows than
in Linux.
Date: 2007-11-18 10:27
Sender: Shyouhei Urabe

Assigning to Matz; 1.9 specific.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
assigned_toshyouhei2007-11-18 10:27shyouhei