i18nutil/source/utility/unicode.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
New commits: commit c93db073425e61907a290f3f5826c0f79f310275 Author: Justin Luth <justin_l...@sil.org> Date: Thu Nov 5 17:22:42 2015 +0300 related tdf#73691 - prevent AltX creating control characters Do nothing for numbers 0x00 - 0x1f. Change-Id: Idda596e735c464b97dc3624253ebbea86933ff2c Reviewed-on: https://gerrit.libreoffice.org/19654 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx index 8b56239..a7d3d46 100644 --- a/i18nutil/source/utility/unicode.cxx +++ b/i18nutil/source/utility/unicode.cxx @@ -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(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits