Kaydet (Commit) cc7edea1 authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Caolán McNamara

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/18708Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
(cherry picked from commit e7ff9ade)
Reviewed-on: https://gerrit.libreoffice.org/18744
üst 7a4edfbc
...@@ -741,11 +741,16 @@ OUString SalDisplay::GetKeyNameFromKeySym( KeySym nKeySym ) const ...@@ -741,11 +741,16 @@ OUString SalDisplay::GetKeyNameFromKeySym( KeySym nKeySym ) const
if( aRet.isEmpty() ) if( aRet.isEmpty() )
{ {
const char *pString = XKeysymToString( nKeySym ); const char *pString = XKeysymToString( nKeySym );
int n = strlen( pString ); if (pString)
if( n > 2 && pString[n-2] == '_' ) {
aRet = OUString( pString, n-2, RTL_TEXTENCODING_ISO_8859_1 ); 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 else
aRet = OUString( pString, n, RTL_TEXTENCODING_ISO_8859_1 ); aRet = "???";
} }
} }
} }
......
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