Kaydet (Commit) c93db073 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Eike Rathke

related tdf#73691 - prevent AltX creating control characters

Do nothing for numbers 0x00 - 0x1f.

Change-Id: Idda596e735c464b97dc3624253ebbea86933ff2c
Reviewed-on: https://gerrit.libreoffice.org/19654Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst dd971d00
......@@ -1084,6 +1084,13 @@ bool ToggleUnicodeCodepoint::AllowMoreInput(sal_Unicode uChar)
return false;
}
// 0 - 1f are control characters. Do not process those.
if( uChar < 0x20 )
{
mbAllowMoreChars = false;
return false;
}
switch( uChar )
{
case 'u':
......@@ -1117,9 +1124,6 @@ bool ToggleUnicodeCodepoint::AllowMoreInput(sal_Unicode uChar)
maInput.insertUtf32(0, uChar);
}
break;
case 0:
mbAllowMoreChars = false;
break;
default:
// + already found. Since not U, cancel further input
if( mbRequiresU )
......@@ -1185,15 +1189,15 @@ OUString ToggleUnicodeCodepoint::StringToReplace()
while( nUPlus != -1 )
{
nUnicode = sIn.copy(0, nUPlus).toString().toUInt32(16);
//strip out all null or invalid Unicode values
if( !nUnicode || nUnicode > 0x10ffff )
//prevent creating control characters or invalid Unicode values
if( nUnicode < 0x20 || nUnicode > 0x10ffff )
maInput = sIn.copy(nUPlus);
sIn = sIn.copy(nUPlus+2);
nUPlus = sIn.indexOf("U+");
}
nUnicode = sIn.toString().toUInt32(16);
if( !nUnicode || nUnicode > 0x10ffff )
if( nUnicode < 0x20 || nUnicode > 0x10ffff )
maInput.truncate().append( sIn[sIn.getLength()-1] );
return maInput.toString();
}
......
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