About 385,000 results
Open links in new tab
  1. How does a "stack overflow" occur and how do you prevent it?

    Aug 25, 2008 · Stack overflow occurs when your program uses up the entire stack. The most common way this happens is when your program has a recursive function which calls itself forever. Every new call to the recursive function takes more stack until eventually your program uses up the entire stack.

  2. Heap overflow and Stack overflow - GeeksforGeeks

    Mar 10, 2023 · Stack Overflow: Stack is a special region of our process’s memory which is used to store local variables used inside the function, parameters passed through a function and their return addresses. Whenever a new local variable is declared it is pushed onto the stack.

  3. Can you give an example of stack overflow in C++?

    Here's one that might happen in practice: return x == 0 ? 1 : x * factorial(x-1); This overflows the stack for negative x. And, as Frank Krueger mentioned, also for too large x (but then int would overflow first). Keep trying to return main until the stack runs out? return main(argc, argv); It's not legal to call main () in C++.

  4. How to create a Minimal, Reproducible Example - Stack Overflow

    Streamline your example in one of two ways: Restart from scratch. Create a new program, adding in only what is needed to see the problem. Use simple, descriptive names for functions and variables – don’t copy the names you’re using in your existing code. Divide and conquer.

  5. Understanding and Demonstrating Stack Overflow in C

    Jan 18, 2024 · Let’s look at a simple code example that intentionally causes a stack overflow: function(); return 0; In this C program, the `function` is defined to call itself without any termination...

  6. What is a stack overflow error? - TechTarget

    Learn about stack overflow, a buffer error that occurs when programs try to use more memory than has been allocated, which can cause programs to terminate.

  7. C++ stack overflow | How stack overflow works in C++ with Examples

    Apr 15, 2023 · Stack overflow is a software bug which occurs when a program tries to access more memory than the available stack size, which results in the crashing of the program. Stack is Last in First Out data structure (LIFO).

  8. Stack-based buffer overflows - Medium

    Oct 23, 2023 · There are two types of buffer overflows: stack-based and heap-based. In this post, we will talk about the first type. What’s the stack? Before jumping right into stack-based buffer overflows,...

  9. c-example-code/stack_overflow.c at main - GitHub

    * Description: Examples of stack overflow errors in C. * YouTube Lesson: https://www.youtube.com/watch?v=D3scXBzRQUk * Author: Kevin Browne @ https://portfoliocourses.com

  10. Detection of possible / potential stack overflow problems in a c / …

    Dec 23, 2022 · It is important for developers to be able to identify and address potential stack overflow problems so they can be avoided or fixed before they cause any issues. In this blog post, we’ll go over some of the ways you can detect possible stack overflow problems in …

Refresh