[#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: Sean Russell <ser@...>
Date: 2006-09-11 16:01:30 UTC
List: ruby-core #8841
On Monday 11 September 2006 03:58, Marc Haisenko wrote:
> 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).

Wow.  It is as if I never said "on 32-bit x86".  Eerie.

--- SER

In This Thread