rre: exit on stack over/underflow

FossilOrigin-Name: da30938315fc7bf557b531b62c980b94919afae6d714eb0455744efeb28ece8c
This commit is contained in:
crc 2019-03-20 19:31:40 +00:00
parent 0be3f37615
commit 8eb08c0679
2 changed files with 9 additions and 1 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/rre
#!/usr/bin/env retro
# Atua: A Gopher Server

View file

@ -261,6 +261,14 @@ void rre_execute(CELL cell, int silent) {
printf("At %d, opcode %d\n", ip, opcode);
#ifdef USE_TERMIOS
restore_term();
#endif
exit(1);
}
if (sp < 0 || sp > STACK_DEPTH) {
printf("Stack Limits Exceeded!\n");
printf("At %d, opcode %d\n", ip, opcode);
#ifdef USE_TERMIOS
restore_term();
#endif
exit(1);
}