From 53f79e426138004dfff3fec9f3e388be3318a070 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Sat, 14 Apr 2012 01:11:57 -0400 Subject: [PATCH] Fix vttest "Funny scrolling regions" by ignoring some invalid scroll regions Addresses #155 github issue. --- src/terminal/terminalfunctions.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/terminal/terminalfunctions.cc b/src/terminal/terminalfunctions.cc index 2dd69f7..ea3c938 100644 --- a/src/terminal/terminalfunctions.cc +++ b/src/terminal/terminalfunctions.cc @@ -316,6 +316,12 @@ void CSI_DECSTBM( Framebuffer *fb, Dispatcher *dispatch ) int top = dispatch->getparam( 0, 1 ); int bottom = dispatch->getparam( 1, fb->ds.get_height() ); + if ( (bottom <= top) + || (top > fb->ds.get_height()) + || (top == 0 && bottom == 1) ) { + return; /* invalid, xterm ignores */ + } + fb->ds.set_scrolling_region( top - 1, bottom - 1 ); fb->ds.move_row( 0 ); fb->ds.move_col( 0 );