Prevent crashing when dumping binary files to terminal.

"cat"ing binary files often crashes Konsole.  This patch checks the
indicies.
Note that there are tons of 'undecodable sequences' that also print
out.  These likely should not be displayed unless debugging.
BUG: 184964
FIXED-IN: 4.8
wilder-portage
Kurt Hindenburg 15 years ago
parent e9e729074b
commit 0905a301e6
  1. 7
      src/Screen.cpp

@ -659,6 +659,13 @@ void Screen::displayCharacter(unsigned short c)
charToCombineWithX = cuX - 1;
charToCombineWithY = cuY;
}
// Prevent "cat"ing binary files from causing crashes.
if (charToCombineWithX >= screenLines[charToCombineWithY].size())
{
return;
}
Character& currentChar = screenLines[charToCombineWithY][charToCombineWithX];
if ((currentChar.rendition & RE_EXTENDED_CHAR) == 0)
{

Loading…
Cancel
Save