stack-overflow

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

时间秒杀一切 提交于 2019-12-03 06:35:38
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 attacks impossible? Does a canary make these types of attacks impossible? No, it doesn't. It makes it

How to get full stack of StackOverflowError

99封情书 提交于 2019-12-03 06:34:45
问题 When observing a StackOverflowError how to retrieve the full call stack? Consider this simple example: public class Overflow { public Overflow() { new Overflow(); } public static void a() { new Overflow(); } public static void main(String[] argv) { a(); } } Now the error reported is: Exception in thread "main" java.lang.StackOverflowError at Overflow.<init>(Overflow.java:11) [last line repeated many times] But I can't see the main and a method in the stack trace. My guess is this is because

clojure cons vs conj with lazy-seq

末鹿安然 提交于 2019-12-03 05:42:14
问题 Why does cons work in this context with lazy-seq, but conj doesn't? This works: (defn compound-interest [p i] (cons p (lazy-seq (compound-interest (* p (+ 1 i)) i)))) This doesn't (it gives a stack overflow[1] exception): (defn compound-interest2 [p i] (conj (lazy-seq (compound-interest2 (* p (+ 1 i)) i)) p)) [1] Oh ya! Asking a question involving a stack overflow on stackoverflow. 回答1: (conj collection item) adds item to collection . To do that, it needs to realize collection . (I'll explain

Does Elixir infinite recursion ever overflow the stack?

核能气质少年 提交于 2019-12-03 05:21:23
A number of different how-tos on Elixir programming express the view that storing state or running an infinite loop is done idiomatically either by spinning the data off into an Agent or Task, or by infinite recursion of the function that needs state. They don't mention any limits on how deep the recursion can go or any other caveats. Since searching for "Elixir stack overflow" just results in hits to this website, let me remove the ambiguity and ask here: What implementation guarantees are there in Elixir to make sure that infinite recursion as a method of 'looping' won't result in a stack

How do I track down the cause of a StackOverflowException in .NET?

☆樱花仙子☆ 提交于 2019-12-03 04:46:01
问题 I get a StackOverflowException when I run the following code: private void MyButton_Click(object sender, EventArgs e) { MyButton_Click_Aux(); } private static volatile int reportCount; private static void MyButton_Click_Aux() { try { /*remove because stack overflows without*/ } finally { var myLogData = new ArrayList(); myLogData.Add(reportCount); myLogData.Add("method MyButtonClickAux"); Log(myLogData); } } private static void Log(object logData) { // my log code is not matter } What could

How to handle or avoid a stack overflow in C++

别来无恙 提交于 2019-12-03 03:41:52
问题 In C++ a stack overflow usually leads to an unrecoverable crash of the program. For programs that need to be really robust, this is an unacceptable behaviour, particularly because stack size is limited. A few questions about how to handle the problem. Is there a way to prevent stack overflow by a general technique. (A scalable, robust solution, that includes dealing with external libraries eating a lot of stack, etc.) Is there a way to handle stack overflows in case they occur? Preferably,

How to avoid stack space overflows?

五迷三道 提交于 2019-12-03 03:39:05
I've been a bit surprised by GHC throwing stack overflows if I'd need to get value of large list containing memory intensive elements. I did expected GHC has TCO so I'll never meet such situations. To most simplify the case look at the following straightforward implementations of functions returning Fibonacci numbers (taken from HaskellWiki). The goal is to display millionth number. import Data.List # elegant recursive definition fibs = 0 : 1 : zipWith (+) fibs (tail fibs) # a bit tricky using unfoldr from Data.List fibs' = unfoldr (\(a,b) -> Just (a,(b,a+b))) (0,1) # version using iterate

F# vs OCaml: Stack overflow

被刻印的时光 ゝ 提交于 2019-12-03 01:17:47
问题 I recently found a presentation about F# for Python programmers, and after watching it, decided to implement a solution to the "ant puzzle" on my own. There is an ant which can walk around on a planar grid. The ant can move one space at a time left, right, up or down. That is, from cell (x, y) the ant can go to cells (x+1, y), (x-1, y), (x, y+1), and (x, y-1). Points where the sum of the digits of the x and y coordinates are greater than 25 are inaccessible to the ant. For example, the point

Hibernate OneToMany java.lang.StackOverflowError

二次信任 提交于 2019-12-03 01:04:36
It's my first question here on stack, so please be gentle :D I'm trying to create hibernate OneToMany relationship. When I try to fetch some data from my DB, I'm getting StackOverflowError. But when i remove OneToMany part, everything goes normally. This is part of my REST Service, for now it runs on VMware vFabric Server and MySQL DB. Fetch example: @Inject private EntityManager entityManager; ... entityManager.find(League.class, 1); ... entityManager.find(Team.class, 1); MySQL script: CREATE TABLE league ( id int(11) NOT NULL AUTO_INCREMENT, name varchar(20) COLLATE utf8_unicode_ci NOT NULL,

Why is #include <string> preventing a stack overflow error here?

99封情书 提交于 2019-12-03 00:56:41
问题 This is my sample code: #include <iostream> #include <string> using namespace std; class MyClass { string figName; public: MyClass(const string& s) { figName = s; } const string& getName() const { return figName; } }; ostream& operator<<(ostream& ausgabe, const MyClass& f) { ausgabe << f.getName(); return ausgabe; } int main() { MyClass f1("Hello"); cout << f1; return 0; } If I comment out #include <string> I don't get any compiler error, I guess because it's kind of included through #include