[Libreoffice-commits] core.git: vcl/unx

Julien Nabet serval2412 at yahoo.fr
Mon Sep 21 05:01:59 PDT 2015


 vcl/unx/generic/app/saldisp.cxx |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit e7ff9ade29aff212b2e2728a15bbf5a11f5b8717
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Fri Sep 18 22:48:55 2015 +0200

    tdf#94275: core dump when XKeysymToString returns NULL
    
    0  strlen () at ../sysdeps/x86_64/strlen.S:106
    1  0x00007fffdfd69083 in SalDisplay::GetKeyNameFromKeySym (this=this at 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 at 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 at entry=0x7fffffffbfb0, pWindow=<optimised out>, pWindow at 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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 9f08021..4b47eda 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 = "???";
             }
         }
     }


More information about the Libreoffice-commits mailing list