PlainError

Segmentation fault (core dumped)

Last checked 2026-10-26 · 3 fixes · reviewed answer

TL;DRA program crashed because it tried to read or write memory it was not allowed to access, such as a null pointer or invalid array index.

Most likely cause: Code accessing invalid memory like a null pointer or out-of-bounds array

Try first: Reproduce the crash with a debugger to see the exact line (gdb ./yourprogram)

Likely causes

  1. Code accessing invalid memory like a null pointer or out-of-bounds arraymost likely
  2. Buffer overflow or use-after-free bug in the programpossible
  3. Corrupted input data or environment-specific memory limitsless likely

How to fix it

Safest first: SafeChanges settingsDangerous
  1. Reproduce the crash with a debugger to see the exact lineSafe

    Run the program inside gdb to get a stack trace showing where the fault occurred.

    gdb ./yourprogram
  2. Check the source code around the crash location for pointer or array errorsSafe

    Look for uninitialized pointers, missing null checks, or loops that go past array bounds.

  3. Recompile the program with debug symbols and memory checking toolsSafe

    Add -g flag and run under valgrind to detect invalid memory accesses.

    gcc -g yourcode.c -o yourprogram && valgrind ./yourprogram

If that didn't fix it

Run the program with strace to trace system calls and see the last operation before the fault

When to see a technician

If this occurs in a third-party binary you cannot modify, contact the software developer with the stack trace.

Quick answers

What does Segmentation fault (core dumped) mean?
A program crashed because it tried to read or write memory it was not allowed to access, such as a null pointer or invalid array index.
What causes Segmentation fault (core dumped)?
Code accessing invalid memory like a null pointer or out-of-bounds array. (most likely) Buffer overflow or use-after-free bug in the program. (possible) Corrupted input data or environment-specific memory limits. (less likely)
How do I fix Segmentation fault (core dumped)?
Try these in order, safest first: 1. Reproduce the crash with a debugger to see the exact line. 2. Check the source code around the crash location for pointer or array errors. 3. Recompile the program with debug symbols and memory checking tools.
What if that didn't fix it?
Run the program with strace to trace system calls and see the last operation before the fault
When should I see a technician?
If this occurs in a third-party binary you cannot modify, contact the software developer with the stack trace.
Did this fix it? Report a problem

Related errors

All Coding errors →