Bug 57913 - Calling xkb_keymap_new_from_file from Java crashes
Summary: Calling xkb_keymap_new_from_file from Java crashes
Status: RESOLVED FIXED
Alias: None
Product: libxkbcommon
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Daniel Stone
QA Contact: Ran Benita
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-05 14:22 UTC by Nicholas Allen
Modified: 2012-12-06 04:07 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
contains everything to reproduce bug in simplest way (36.95 KB, text/plain)
2012-12-05 14:22 UTC, Nicholas Allen
Details

Description Nicholas Allen 2012-12-05 14:22:56 UTC
Created attachment 71030 [details]
contains everything to reproduce bug in simplest way

If xkb_keymap_new_from_file is called from Java via a JNI library then it crashes. When called from a native application that links to the exact same JNI library the function works perfectly.

Attached is a zip file that demonstrates in the simplest way possible the crash from Java and it working fine called via the JNI library linked by a native application.

To Build:
    - extract zip
    - cd xkbbug
    - edit build.sh JDK variable to point to where your JDK is.
    - sh ./build.sh

To Run from java:
    - sh ./run-from-java.sh

To Run native app that calls same code:
    - sh ./run-native.sh

I've also included prebuilt binaries for 64 bit Linux so you don't need to manually build. When run from Java you will see that it core dumps when trying to load the keyboard file.
Comment 1 Daniel Stone 2012-12-06 04:07:31 UTC
Fixed in git:

commit bb620df7aa98c129687382e4866e643b8482fc59
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Thu Dec 6 15:04:15 2012 +1100

    Parser: Initialise geometry elements for VarDecl

    We were using uninitialised memory whilst parsing geometry, leaving
    random contents as the return for shape/overlay/etc sections.  Somehow
    this actually worked everywhere but under Java.

    https://bugs.freedesktop.org/show_bug.cgi?id=57913

    Signed-off-by: Daniel Stone <daniel@fooishbar.org>


Thanks for the testcase, it really helped.  This should make it into an 0.2.1 sometime before Christmas.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.