Commit 69b53c00 authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

prevent crashing when selecting invalid unicode character.

Konsole goes into an infinite loop and will eventually crash due to
memory.  On an invalid unicode char the width is 0 so the for loop never
A better patch by Francesco Cecconi <>

BUG: 303390
parent 248f2c3c
......@@ -114,13 +114,8 @@ void PlainTextDecoder::decodeLine(const Character* const characters, int count,
const ushort* chars = ExtendedCharTable::instance.lookupExtendedChar(characters[i].character, extendedCharLength);
if (chars) {
const QString s = QString::fromUtf16(chars, extendedCharLength);
const int stringWidth = string_width(s);
// Infinite loop here if i is not incremented bko 303390
if (stringWidth < 1) {
i += stringWidth;
i += qMax(1, string_width(s));
} else {
// All characters which appear before the last real character are
Markdown is supported
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