stack-overflow

Stack Overflow: Duplicate temporary allocation in stack space?

旧时模样 提交于 2019-12-09 15:07:18
问题 struct MemBlock { char mem[1024]; MemBlock operator*(const MemBlock &b) const { return MemBlock(); } } global; void foo(int step = 0) { if (step == 10000) { global = global * MemBlock(); } else foo(step + 1); } int main() { foo(); return 0; } Program received signal SIGSEGV, Segmentation fault. 0x08048510 in foo (step=4000) at t.cpp:12 12 void foo(int step = 0) { It seems that the MemBlock() instance costs a lot of stack memory though it hasn't been called yet (check gdb info). And when I use

c stack smashing detected

假装没事ソ 提交于 2019-12-09 12:58:06
问题 I've created a file which prints Hello, world as many times at the user wants to give input. #include <stdio.h> #include <string.h> int main() { char message[10]; int count, i; strcpy(message, "Hello, world!"); printf("Repeat how many times? "); scanf("%d", &count); for(i=0; i < count; i++) printf("%3d - %s\n", i, message); } No matter what the number entered it always results in a "stack smash". Here is the program, can anyone come up with a conclusion to why it is doing this? Here is the

Recovering from stack overflow or heap exhaustion in a Haskell program

∥☆過路亽.° 提交于 2019-12-09 06:28:45
问题 I am currently writting a genetic algorithm in Haskell in which my chromosomes are rather complex structures representing executable systems. In order for me to evaluate the fitness of my chromosomes I have to run an evolution function which performs one computational cycle of a given system. The fitness then is calculated just by counting how many times the evolution can be applied before there is no change in the system (in which case the system terminates). The problem now is as follows:

Do canaries prevent return-into-libc and return-oriented programming attacks?

 ̄綄美尐妖づ 提交于 2019-12-09 05:19:56
问题 I am trying to understand if/how return-into-libc and return-oriented programming exploits are possible if a canary is being used. A canary would be placed on the stack in between the return value and the buffer to be overflown, and would need to be overwritten in order to change the return value to the location of a library function or computation. Canaries have been around since 1997 (StackGuard) and ROP is a technique first introduced in 2007 (Shacham). Does a canary make these types of

Trying to smash the stack

不羁岁月 提交于 2019-12-09 05:03:09
问题 I am trying to reproduce the stackoverflow results that I read from Aleph One's article "smashing the stack for fun and profit"(can be found here:http://insecure.org/stf/smashstack.html). Trying to overwrite the return address doesn't seem to work for me. C code: void function(int a, int b, int c) { char buffer1[5]; char buffer2[10]; int *ret; //Trying to overwrite return address ret = buffer1 + 12; (*ret) = 0x4005da; } void main() { int x; x = 0; function(1,2,3); x = 1; printf("%d\n",x); }

Why stack overflow causes segmentation fault instead of stack overflow in Linux? [duplicate]

不打扰是莪最后的温柔 提交于 2019-12-09 02:32:57
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: What is the difference between a segmentation fault and a stack overflow? I was just wondering, why stack overflow results in segmentation fault instead of stack overflow. Is it because the boundary of stack limit is crossed which causes SIGSEGV? Why we don't encounter stack overflow in Linux, and rather a segmentation fault? int foo() { return foo(); } This small code should cause stack overflow but rather it

How to avoid stack overflow in Haskell?

佐手、 提交于 2019-12-09 02:31:36
问题 Haskell does not support cycling for computation, instead it offers to use recursion algorithms. But this approach leads to growing of stack, and even stack overflow. I believe there should be approach to solve this problem in general. Here is the sample. I wanted to know, how many times getClockTime may be called per 5 seconds: import System.Time nSeconds = 5 main = do initTime <- totalPicoSeconds `fmap` getClockTime doWork initTime 1 where doWork initTime n = do currTime <- totalPicoSeconds

StackOverflowError when operating with a large number of columns in Spark

柔情痞子 提交于 2019-12-09 00:01:37
问题 I have a wide dataframe (130000 rows x 8700 columns) and when I try to sum all columns I´m getting the following error: Exception in thread "main" java.lang.StackOverflowError at scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:59) at scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:59) at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33) at scala.collection.mutable.WrappedArray.foreach(WrappedArray

'System.StackOverflowException' when sorting a GridView

天涯浪子 提交于 2019-12-08 23:14:39
When I try to sort a GridView, the system returns this error-message: gridview sort An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.dll This is the code and "Melder" is the name of the column to sort. gvOutlookMeldingen.Sort("Melder", SortDirection.Ascending); You are probably calling Sort() inside gvOutlookMeldingen_Sorting , which will call gvOutlookMeldingen_Sorting and Sort() again, thus generating a loop. On the Sorting event you need to call functions that alter the data source and perform the query again. Or if it's automatically bound, you don't

Diagnosing RangeError: Maximum call stack size exceeded in React KeyEscapeUtils

蓝咒 提交于 2019-12-08 21:05:51
问题 Background Our webapp is written with React and Redux using the official react-redux bindings. Another primary library used in this web app is PaperJS. We recently transitioned this to being a Redux app, though it has used React for a while. The Problem Refreshing sometimes (usually every other refresh) causes a RangeError: Maximum call stack size exceeded at String.replace (<anonymous>) at Object.unescape (KeyEscapeUtils.js:49) at flattenSingleChildIntoContext (flattenChildren.js:32) at