[#8815] Segfault in libc strlen, via rb_str_new2 — "Sean E. Russell" <ser@...>

Howdy,

12 messages 2006/09/09
[#8817] Re: Segfault in libc strlen, via rb_str_new2 — Eric Hodel <drbrain@...7.net> 2006/09/09

On Sep 8, 2006, at 10:10 PM, Sean E. Russell wrote:

Re: [ ruby-Bugs-5822 ] Ruby's 'etc' module cannot handle the UID of OS X 'nobody' properly

From: Yukihiro Matsumoto <matz@...>
Date: 2006-09-21 05:46:50 UTC
List: ruby-core #8903
Hi,

In message "Re: [ ruby-Bugs-5822 ] Ruby's 'etc' module cannot handle the UID of OS X 'nobody' properly"
    on Thu, 21 Sep 2006 14:42:58 +0900, Jim Freeze <jimfreeze@gmail.com> writes:

|> |p Etc.getpwnam('nobody')
|> |p Etc.getpwuid(4294967294)
|> |--
|> |
|> |Apparently OS X assigns -1 to nobody in some places, and ruby is  
|> hitting one of those places. However, the underlying problem seems  
|> to be that Etc can output a value in some of it's calls that it  
|> can't accept as a parameter.
|>
|> Would anybody report what happens when we run the above script on OSX?
|> I'm not sure the exact situation.
|
|Here it is on 1.8.4 for reference:
|
|% irb
|irb(main):001:0> require 'etc'
|=> true
|irb(main):002:0> p Etc.getpwnam('nobody')
|#<struct Struct::Passwd name="nobody", passwd="*", uid=-2, gid=-2,  
|gecos="Unprivileged User", dir="/var/empty", shell="/usr/bin/false",  
|change=0, uclass="", expire=0>
|=> nil
|irb(main):003:0> p Etc.getpwuid(4294967294)
|RangeError: bignum too big to convert into `long'
|         from (irb):3:in `getpwuid'
|         from (irb):3
|         from :0
|irb(main):004:0> RUBY_VERSION
|=> "1.8.4"
|irb(main):005:0> RUBY_PLATFORM
|=> "powerpc-darwin8.4.0"

Thank you guys.  I fixed it on the CVS.  Would somebody check the fix?

							matz.

In This Thread

Prev Next