SLOF/slof
Thomas Huth e78980bd0c Fix stack underflow that occurs with duplicated ESC in input
When I tried to abort the net-snk TFTP boot by pressing ESC
a couple of times, I sometimes noticed that SLOF ended up
with a negative stack depth counter. After doing some closer
investigation, I disovered that the problem can be reproduced
by simply pressing "ESC ESC RETURN" at the SLOF prompt.

The problem is in the code in accept.fs: If an ESC character is
found in the input stream, the "handle-ESC" function is called.
This reads in the next input character with "key", and if it
does not match 0x5b or 0x4f, it calls "handle-meta" for further
handling. handle-meta consumes the value from "key" on the stack
to use it as an index into a jump table, thus the stack is empty
now. If the index was a 0x1b (due to the second ESC character),
the function handle-CSI is called. But that function expects
another value as index for a jump table on the stack, and since
the stack was already empty, we end up with a negative stack
depth here.
Apparently, handle-meta should call a function instead that
uses "key" to get another character from the input stream,
before calling the handle-CSI function.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Tested-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-05-24 17:45:06 +10:00
..
fs Fix stack underflow that occurs with duplicated ESC in input 2016-05-24 17:45:06 +10:00
Makefile.inc Output banner and initial display output in VNC window 2013-12-16 11:56:42 +05:30
OF.lds Initial import of slof-JX-1.7.0-4 2010-12-01 09:51:44 +11:00
allocator.c Implement range allocator 2013-10-04 12:01:20 +05:30
default-font.c Initial import of slof-JX-1.7.0-4 2010-12-01 09:51:44 +11:00
engine.in Improved "tick", postpone and $FIND commands 2011-12-28 15:05:23 +01:00
entry.S Check for stack overflow in paflof engine 2015-12-01 17:02:04 +11:00
helpers.c pci: add byte read/write helper routines 2016-02-08 16:40:38 +11:00
lowmem.S Initial qemu/KVM board support 2011-03-22 15:22:00 +01:00
ofw.S Work around missing sc 1 traps on pHyp 2013-12-17 11:01:46 +05:30
paflof.c Check for stack overflow in paflof engine 2015-12-01 17:02:04 +11:00
paflof.h Initial import of slof-JX-1.7.0-4 2010-12-01 09:51:44 +11:00
ppc64.c slof: Change call_c() function to a proper assembler function 2015-09-17 11:45:32 +10:00
ppc64.code Implement range allocator 2013-10-04 12:01:20 +05:30
ppc64.h Initial qemu/KVM board support 2011-03-22 15:22:00 +01:00
ppc64.in Implement range allocator 2013-10-04 12:01:20 +05:30
prep.h Initial import of slof-JX-1.7.0-4 2010-12-01 09:51:44 +11:00
prim.code fbuffer: Implement RFILL as an accelerated primitive 2015-08-05 16:02:18 +10:00
prim.in Remove unused RMOVE64 stub 2015-08-05 16:02:26 +10:00
ref.pl Initial import of slof-JX-1.7.0-4 2010-12-01 09:51:44 +11:00
types.h Initial import of slof-JX-1.7.0-4 2010-12-01 09:51:44 +11:00