maybe this is obvious - but i'll say it anyway

ret needs to restore the previous "context" to
what it was at the time of the procedure call

That context information is stored on the stack.

If something is trashing the stack (like a buffer
overflow for example) then the ret instruction
will try to restore context information (including the
address of the next instruction) from garbage.

and - if you're lucky - you'll get an address violation.

it sounds like this is what's happening.

be happy you're getting the address violation.
otherwise these beasts can be very hard to find.

-ns




----- Original Message -----
From: "Rohit Gupta" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Saturday, April 14, 2001 4:46 PM
Subject: [DUG]: Delphi Compiler problems


> I am having problems of memory corruption in two separate, unrelated (in
the
> sens of components used) apps, where the ret instruction causes the
> corruption of memory inside an unrelated object.
>
> I am lost.  Is the simple ret no longer a ret ?  Its coded as C3 in the
> standard triad
>
>
> mov esp,ebp
> pop ebp
> ret
>
> And its the execution of teh ret that causes it...
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to