diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2015-09-18 22:48:55 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-21 12:01:30 +0000 |
commit | e7ff9ade29aff212b2e2728a15bbf5a11f5b8717 (patch) | |
tree | 465856d7f40d2c467834869801ec385c1c9d5068 /vcl/unx | |
parent | af814158b101418adad4f9a21d3b2303620b0396 (diff) |
tdf#94275: core dump when XKeysymToString returns NULL
0 strlen () at ../sysdeps/x86_64/strlen.S:106
1 0x00007fffdfd69083 in SalDisplay::GetKeyNameFromKeySym (this=this@entry=0x1121b30, nKeySym=<optimised out>)
at /build/libreoffice-Ke3JzN/libreoffice-5.0.1~rc2/vcl/unx/generic/app/saldisp.cxx:744
2 0x00007fffdfd696f5 in SalDisplay::GetKeyName (this=0x1121b30, nKeyCode=nKeyCode@entry=9476) at /build/libreoffice-Ke3JzN/libreoffice-5.0.1~rc2/vcl/unx/generic/app/saldisp.cxx:798
3 0x00007fffe17892a2 in GtkSalFrame::GetKeyName (this=<optimised out>, nKeyCode=<optimised out>) at /build/libreoffice-Ke3JzN/libreoffice-5.0.1~rc2/vcl/unx/gtk/window/gtksalframe.cxx:3005
4 0x00007ffff6125bbc in vcl::KeyCode::GetName (this=this@entry=0x7fffffffbfb0, pWindow=<optimised out>, pWindow@entry=0x0)
at /build/libreoffice-Ke3JzN/libreoffice-5.0.1~rc2/vcl/source/window/keycod.cxx:108
Thank you Alex Bennée for having noticed this.
Change-Id: I4fa89241c72144d5c76cd6175368c6878fc57a46
Reviewed-on: https://gerrit.libreoffice.org/18708
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/app/saldisp.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 9f08021e7308..4b47eda86841 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -741,11 +741,16 @@ OUString SalDisplay::GetKeyNameFromKeySym( KeySym nKeySym ) const if( aRet.isEmpty() ) { const char *pString = XKeysymToString( nKeySym ); - int n = strlen( pString ); - if( n > 2 && pString[n-2] == '_' ) - aRet = OUString( pString, n-2, RTL_TEXTENCODING_ISO_8859_1 ); + if (pString) + { + int n = strlen( pString ); + if( n > 2 && pString[n-2] == '_' ) + aRet = OUString( pString, n-2, RTL_TEXTENCODING_ISO_8859_1 ); + else + aRet = OUString( pString, n, RTL_TEXTENCODING_ISO_8859_1 ); + } else - aRet = OUString( pString, n, RTL_TEXTENCODING_ISO_8859_1 ); + aRet = "???"; } } } |