$ ./a.out cube.stl
When I use a larger input file I get a stack smashing error.
$ ./a.out Pump.stl
*** stack smashing detected ***: ./a.out terminated
Aborted (core dumped)
Does anyone know what this means?
Thank you
$ ./a.out cube.stl
When I use a larger input file I get a stack smashing error.
$ ./a.out Pump.stl
*** stack smashing detected ***: ./a.out terminated
Aborted (core dumped)
Does anyone know what this means?
Thank you
Quote:Original post by LessBread
My guess is that message means that the program has used up all of the available stack and therefore can no longer continue executing.
I would guess that the code for the program uses a local variable to hold the contents of the file. Local variables reside on the stack. So there's no problem reading in a small file but there is reading in a larger file. If that is the case, the solution is to allocate memory from the heap (ie using malloc or new) to hold the contents of the file.
Quote:Original post by PlayfulPuppy
But isn't that a stack overflow, not a stack smash?
A stack smash normally occurs when you overflow a buffer and overwrite the function calls return address, so when the stack tries to pop it goes into la-la land.
Quote:Original post by PlayfulPuppyQuote:Original post by LessBread
My guess is that message means that the program has used up all of the available stack and therefore can no longer continue executing.
I would guess that the code for the program uses a local variable to hold the contents of the file. Local variables reside on the stack. So there's no problem reading in a small file but there is reading in a larger file. If that is the case, the solution is to allocate memory from the heap (ie using malloc or new) to hold the contents of the file.
But isn't that a stack overflow, not a stack smash?
A stack smash normally occurs when you overflow a buffer and overwrite the function calls return address, so when the stack tries to pop it goes into la-la land.
Quote:Original post by PlayfulPuppyQuote:Original post by LessBread
My guess is that message means that the program has used up all of the available stack and therefore can no longer continue executing.
I would guess that the code for the program uses a local variable to hold the contents of the file. Local variables reside on the stack. So there's no problem reading in a small file but there is reading in a larger file. If that is the case, the solution is to allocate memory from the heap (ie using malloc or new) to hold the contents of the file.
But isn't that a stack overflow, not a stack smash?
A stack smash normally occurs when you overflow a buffer and overwrite the function calls return address, so when the stack tries to pop it goes into la-la land.
Quote:Original post by xiuhcoatl
Starting up gdb and walking through should at least show you where this is happening and give you some clues as to why. That may help someone here diagnose the problem or at least what to research..