How does stack overflow happen?


  • Accessing an array out of bounds
  • Dereferencing pointer NULL
  • Dereferencing memory freed
  • Dereferencing uninitialized pointers
  • Incorrect application of operators "&" (addresses) and "*" (references)
  • Formatting errors of specifiers in printf and scanf commands

To debug a core dump, follow these steps:

  1. Obtain a binary identical to the one that generated the core dump file.
  2. Use GDB to debug by running: gdb path/to/the/binary path/to/the/core/dump/file
  3. Retrieve a stack trace at the time of the crash using bt command.

A core dump, also known as a memory dump or crash dump, provides a snapshot of a program’s working memory at a specific moment, usually when the program crashes or terminates unexpectedly.

Core dumps in Ubuntu are handled by Apport and can be found in /var/crash/. If needed, core dump files can be deleted by confirming with "YES".

Lascia un commento