Solved

strange ret?

Posted on 1998-11-09
2
352 Views
Last Modified: 2010-04-02
Dear guys,
     Another unrelated question...
     In an assembly program, What are the likely causes of a ret that jumps to a strange place after the return? The memory model is large which seems okay.

like this....
sub_123 proc far
    :
   :
     ret

sub_123 endp

the ret jumps to a strange place
mov ax, [bp+si]
mov ax, [bp+si]
:
:
:
Thanks
Jacky
0
Comment
Question by:whluk
2 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 20 total points
ID: 1177299
Stack corruption.  To test it, set a breakpoint in the beginning of sub_123 and check the return address that is pushed on the stack.  Set another at the "ret" and check the stack again.  You'll have to single-step in the debugger to see what overwrites the stack.

Another possible cause is a confusion between a near call and a far return (or vice versa) but I think that it is not the case here.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1177300
You've gpt this question asked twice, sort of.  In the other place the return is a far return.

It would help to see the code of the function.  That is the likely culprit.  Also the code that calls the function.  (It does CALL it not JMP to it, right?)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now