Re: 0.9.4.1 Crasher


Subject: Re: 0.9.4.1 Crasher
From: Randy Kramer (rhkramer@fast.net)
Date: Thu Sep 27 2001 - 10:18:31 CDT


Mike Nordell wrote:
> To try to explain. Using the MSVC compiler, a piece of code such as:
>
> something_t* pSomething = getSometPtr();
> int some_int = pSomething->getSomeInt();
>
> and assuming getSomeInt() is an inlined function, it generates assembler
> code like:
>
> [... allocate space for some_int on the stack]
> call getSomePtr
> move some_int, [eax+XXh]
>
> where XXh is the hexadecimal offset of the member from the beginning of the
> type something_t.
>
> So long as getSomePtr() returns a valid pointer to a something_t object all
> is fine. But if getSomePtr() for some reason returen e.g. NULL, and the
> client code doesn't check for NULL pointer, then it's a crash waiting to
> happen.

Ahha! I guess calling a pointer sets the eax register. (Seems clearly
implied by the way Mike wrote it, but I didn't realize that.)

I might get the hang of this someday. ;-)

Randy Kramer



This archive was generated by hypermail 2b25 : Thu Sep 27 2001 - 10:19:09 CDT