[#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: Segfault in libc strlen, via rb_str_new2

From: Marc Haisenko <haisenko@...>
Date: 2006-09-11 07:58:27 UTC
List: ruby-core #8837
On Sunday 10 September 2006 22:57, Eric Hodel wrote:
> On Sep 9, 2006, at 7:16 PM, Sean E. Russell wrote:
> > Hmm.  My C is rusty, but I didn't think there was any difference  
> > between a
> > pointer and an integer on 32-bit x86.
> 
> I don't have one of those (PPC G4).  It is very likely that you'll  
> run into a platform where this will matter, so your code should be  
> correct.

Yes, for example AMD64: sizeof(int) == 4, sizeof(void*) == 8

One is NEVER allowed to assume that a pointer can be stored in an arithmetic 
value, e.g. it's possible that on some architecture arithmetic values are 32 
bit and pointers are 36 bit (IIRC there is an architecture where this is 
really true).

-- 
Marc Haisenko
Comdasys AG

Resheimer Stra゜e 7
D-80686 Mchen
Tel: +49 (0)89 - 548 43 33 21
Fax: +49 (0)89 - 548 43 33 29
e-mail: haisenko@comdasys.com
http://www.comdasys.com

In This Thread