Commit d6b2d317 authored by Robert Knight's avatar Robert Knight
Browse files

Fix crash with invalid selections and memory corruptionwhen updating image in terminal display.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=670435
parent 8782ab7b
......@@ -1379,14 +1379,25 @@ static QString makeString(int *m, int d, bool stripTrailingSpaces)
}*/
bool Screen::isSelectionValid() const
{
return ( sel_TL >= 0 && sel_BR >= 0 );
}
void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder)
{
// do nothing if selection is invalid
if ( !isSelectionValid() )
return;
int top = sel_TL / columns;
int left = sel_TL % columns;
int bottom = sel_BR / columns;
int right = sel_BR % columns;
Q_ASSERT( top >= 0 && left >= 0 && bottom >= 0 && right >= 0 );
//qDebug() << "sel_TL = " << sel_TL;
//qDebug() << "columns = " << columns;
......
......@@ -379,6 +379,8 @@ private: // helper
void effectiveRendition();
void reverseRendition(Character* p);
bool isSelectionValid() const;
/*
The state of the screen is more complex as one would
expect first. The screem does really do part of the
......
......@@ -222,6 +222,8 @@ public:
_v = co >> 8;
_w = co;
break;
default:
Q_ASSERT(false);
}
}
......
......@@ -847,7 +847,7 @@ void TerminalDisplay::updateImage()
for (y = 0; y < linesToUpdate; y++)
{
const Character* currentLine = &_image[y*this->_columns];
const Character* const newLine = &newimg[y*_columns];
const Character* const newLine = &newimg[y*columns];
bool updateLine = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment