[#23457] [Bug #1471] "Mutual join" deadlock detection faulty in 1.8.6 and 1.8.7 — John Carter <redmine@...>

Bug #1471: "Mutual join" deadlock detection faulty in 1.8.6 and 1.8.7

17 messages 2009/05/15

[#23483] [Bug #1478] Ruby archive — Oleg Puchinin <redmine@...>

Bug #1478: Ruby archive

29 messages 2009/05/16
[#29225] [Feature #1478] Ruby archive — Luis Lavena <redmine@...> 2010/04/02

Issue #1478 has been updated by Luis Lavena.

[#30345] Re: [Feature #1478] Ruby archive — "NAKAMURA, Hiroshi" <nakahiro@...> 2010/05/21

On Fri, Apr 2, 2010 at 17:13, Luis Lavena <redmine@ruby-lang.org> wrote:

[#30346] Re: [Feature #1478] Ruby archive — Jonathan Nielsen <jonathan@...> 2010/05/21

> Thanks for your comment.

[#30347] Re: [Feature #1478] Ruby archive — Jonathan Nielsen <jonathan@...> 2010/05/21

OK Hiroshi, I read some of the comments earlier in the thread that I

[#30355] Re: [Feature #1478] Ruby archive — Caleb Clausen <vikkous@...> 2010/05/21

On 5/20/10, Jonathan Nielsen <jonathan@jmnet.us> wrote:

[#30364] Re: [Feature #1478] Ruby archive — Benoit Daloze <eregontp@...> 2010/05/22

Hi,

[#23505] [Bug #1494] tempfile#unlink may silently fail on windows — Nicholas Manning <redmine@...>

Bug #1494: tempfile#unlink may silently fail on windows

19 messages 2009/05/19

[#23572] [Bug #1525] Deadlock in Ruby 1.9's VM caused by ConditionVariable.wait and fork? — Hongli Lai <redmine@...>

Bug #1525: Deadlock in Ruby 1.9's VM caused by ConditionVariable.wait and fork?

27 messages 2009/05/27

[#23595] Meaning of RUBY_PLATFORM — Rick DeNatale <rick.denatale@...>

The RUBY_PLATFORM constant is documented in the latest Pickaxe as "The

17 messages 2009/05/28
[#23596] Re: Meaning of RUBY_PLATFORM — Luis Lavena <luislavena@...> 2009/05/28

On Thu, May 28, 2009 at 3:41 PM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#23602] Re: Meaning of RUBY_PLATFORM — Rick DeNatale <rick.denatale@...> 2009/05/28

On Thu, May 28, 2009 at 2:52 PM, Luis Lavena <luislavena@gmail.com> wrote:

[#23608] Re: Meaning of RUBY_PLATFORM — Luis Lavena <luislavena@...> 2009/05/28

On Thu, May 28, 2009 at 7:08 PM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#23609] Re: Meaning of RUBY_PLATFORM — Rick DeNatale <rick.denatale@...> 2009/05/29

On Thu, May 28, 2009 at 7:22 PM, Luis Lavena <luislavena@gmail.com> wrote:

[ruby-core:23460] [Bug #1472] rb_f_syscall converts string value to null terminated c string, but syscall structs can contain nulls.

From: John Carter <redmine@...>
Date: 2009-05-15 08:41:16 UTC
List: ruby-core #23460
Bug #1472: rb_f_syscall converts string value to null terminated c string, but syscall structs can contain nulls.
http://redmine.ruby-lang.org/issues/show/1472

Author: John Carter
Status: Open, Priority: Normal
ruby -v: ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-linux]

The following snippet invokes the statfs64 syscall.
bug.rb================================================================
string = " "* 84
p syscall( 268, "/", string.size, string)
string = "\0"* 84
p syscall( 268, "/", string.size, string)
======================================================================

If I run this under ruby 1.8.6, both invocations work.

If I run this under ruby 1.8.7, the second one fails with...
ruby  -w bug.rb
0
bug.rb:4:in `syscall': string contains null byte (ArgumentError)
	from bug.rb:4

The reason is in ruby-1.8.7-p22/io.c in the function rb_f_syscall
there is this code....

	if (!NIL_P(v)) {
	    StringValue(v);
	    rb_str_modify(v);
	    arg[i] = (unsigned long)StringValueCStr(v);
	}

In ruby 1.8.6 is was 

	if (!NIL_P(v)) {
	    StringValue(v);
	    rb_str_modify(v);
	    arg[i] = (unsigned long)RSTRING(v)->ptr;
	}

The macro StringValueCStr is defined in ruby.h as....
  #define StringValueCStr(v) rb_string_value_cstr(&(v))

The function rb_string_value_cstr is defined in string.c as ....

rb_string_value_cstr(ptr)
    volatile VALUE *ptr;
{
    VALUE str = rb_string_value(ptr);
    char *s = RSTRING(str)->ptr;

    if (!s || RSTRING(str)->len != strlen(s)) {
	rb_raise(rb_eArgError, "string contains null byte");
    }
    return s;
}

I believe the original 1.8.6 implementation was correct and this
particular changed should be rolled back.

Thanks.

http://rubyforge.org/tracker/index.php?func=detail&aid=20895&group_id=426&atid=1698


Applies to 1.8.7 and 1.9.1 p 129


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next