Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

strange ret?

Posted on 1998-11-09
2
Medium Priority
?
362 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 40 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

604 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