473,466 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

correpted stack

I have a static function in the class like this:

class A
{
static void f1()
}

void A::f1()
{
.....
}

In f1() I declare a number of local variables and once I become the error
message:

Run-Time Check Failure #2 - Stack around the variable '$S28' was corrupted.

Is there a stack limit for such case? Or what should I do?

PS. I work under Win2K MSVC7.0
Jul 19 '05 #1
5 10186

"Ilia Poliakov" <ip*****@allesklar.de> wrote in message
news:bf************@ID-120622.news.uni-berlin.de...
I have a static function in the class like this:

class A
{
static void f1()
}

void A::f1()
{
.....
}

In f1() I declare a number of local variables and once I become the error message:

Run-Time Check Failure #2 - Stack around the variable '$S28' was corrupted.
Is there a stack limit for such case? Or what should I do?


Though stacks have their limits, it is not too likely that that is the
problem in your case. Most likely it is a bug in your code. But it is
difficult to tell what exactly the problem is, since you did not post
minimal yet complete code that demonstrates the problem.

To give you a clue the following code would lead to stack corruption on
many systems:

void A::f1()
{
int a[10];

for(int i=0; i < 20; ++i)
{
a[i] = 123456;
}
}

What will happen here depends on compiler, compiler settings and
platform. But typically when i > 9 this loop will start to overwrite the
return address,and possibly the 'this' pointer and other function
arguments, local variables of the calling function and who knows what
else...
--
Peter van Merkerk
peter.van.merkerk(at)dse.nl


Jul 19 '05 #2
On Tue, 22 Jul 2003 13:40:39 +0200, "Ilia Poliakov" <ip*****@allesklar.de> wrote:
I have a static function in the class like this:

class A
{
static void f1()
}

void A::f1()
{
.....
}

In f1() I declare a number of local variables and once I become the error
message:

Run-Time Check Failure #2 - Stack around the variable '$S28' was corrupted.

Is there a stack limit for such case?
The problem is not related to the function being static.

Or what should I do?


Use a debugger and/or trace output to see what's going wrong. Perhaps
you have infinite recursion.

Post more code and information about the problem.
Jul 19 '05 #3

"Ilia Poliakov" <ip*****@allesklar.de> wrote in message
news:bf************@ID-120622.news.uni-berlin.de...
I have a static function in the class like this:

class A
{
static void f1()
}

void A::f1()
{
.....
}

In f1() I declare a number of local variables and once I become the error
message:

Run-Time Check Failure #2 - Stack around the variable '$S28' was corrupted.
Is there a stack limit for such case? Or what should I do?

PS. I work under Win2K MSVC7.0


Its a bug in your program, most likely a buffer oveflow. Post the code,
we'll fix the bug.

john
Jul 19 '05 #4
sudarshanjagadale
3 New Member
I too face same err.
Run-Time Check Failure #2 - Stack around the variable 'is' was corrupted.

my code was working on VC6.0 but it is not working on VC8.0

regard's
-sudarshan
Jul 24 '06 #5
sudarshanjagadale
3 New Member
can any buddy help me out ....
Jul 24 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Andrew | last post by:
Last night I was reading about implementing my own stack. The example given pushes items on and off the stack at the start and end of each procedure (ie. in a std module). What's not so clear is...
14
by: Kevin Grigorenko | last post by:
Hello, I couldn't find an obvious answer to this in the FAQ. My basic question, is: Is there any difference in allocating on the heap versus the stack? If heap or stack implementation is not...
4
by: Chris Mabee | last post by:
Hello all, and Merry Christmas, I'm having a problem understanding an example of an array based implementation of a stack in a textbook of mine. The code in question is written below. The syntax...
4
by: anonymous | last post by:
Thanks your reply. The article I read is from www.hakin9.org/en/attachments/stackoverflow_en.pdf. And you're right. I don't know it very clearly. And that's why I want to understand it; for it's...
8
by: LedZep | last post by:
What up everyone, I have to write a program that uses a stack to determine whether a string is a palindrome (a string that is spelled identically backward and forward). The program has to...
4
by: alisaee | last post by:
plz check what i have made wrong what is requierd her is to creat class queue and class stack and run the push,pop operation . #include<iostream.h> #include<conio.h> #include<stdio.h> class...
16
by: sarathy | last post by:
Hi all, I need a few clarifications regarding memory allocaion in C++. I apologize for the lengthy explanation. 1. In C++, Objects are allocated in heap. What does heap refer to? Is it an area...
1
by: alfie27 | last post by:
I currently have a working program that is a stack that stores integers. Now i have to convert it to store strings instead of integers. I have been working on this for hours and just keep getting...
11
by: tom | last post by:
Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self): self.items...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.