diff options
author | Oliver-Rainer Wittmann <od@openoffice.org> | 2010-06-04 11:33:04 +0200 |
---|---|---|
committer | Oliver-Rainer Wittmann <od@openoffice.org> | 2010-06-04 11:33:04 +0200 |
commit | 9a2fa49397aee936c030c146b76f861c634e4172 (patch) | |
tree | d6d0d3b9760d26acf58384920b8e454558f8ee16 /vcl/unx | |
parent | d21adcdca61a7c54b3bf1584d80746dc0d2d1fc0 (diff) |
sw33bf05: #i111768# method <GtkSalFrame::IMHandler::signalIMDeleteSurrounding(..)> - include range checking
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 3d11ce8a37ea..1fdd5a611fe5 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -3752,8 +3752,21 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint if (xText.is()) { sal_uInt32 nPosition = xText->getCaretPosition(); - xText->deleteText(nPosition + offset, nPosition + offset + nchars); - return TRUE; + // --> OD 2010-06-04 #i111768# - apply patch from kstribley: + // range checking +// xText->deleteText(nPosition + offset, nPosition + offset + nchars); + sal_Int32 nDeletePos = nPosition + offset; + sal_Int32 nDeleteEnd = nDeletePos + nchars; + if (nDeletePos < 0) + nDeletePos = 0; + if (nDeleteEnd < 0) + nDeleteEnd = 0; + if (nDeleteEnd > xText->getCharacterCount()) + nDeleteEnd = xText->getCharacterCount(); + + xText->deleteText(nDeletePos, nDeleteEnd); + // <-- + return TRUE; } return FALSE; |