That's error from compiler inserted bounds checking that you are usually writing past some locally declared array from either end. Running under gdb should show roughly where on function level as it's only run when returning from a function, so running with valgrind for example might show it earlier as it checks each access. Defining -D_FORTIFY_SOURCE=2 to compile flags might show it earlier too, but I think it's already the default on most distributions.