https://bugs.documentfoundation.org/show_bug.cgi?id=174044

            Bug ID: 174044
           Summary: LOK: libreofficekit_hook_2 crashes (SIGSEGV in
                    lo_destroy) when lo_initialize fails before VCL is
                    initialised
           Product: LibreOffice
           Version: 26.8.1.1 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: [email protected]
          Reporter: [email protected]
            Blocks: 168467

Description:
When lo_initialize() fails, libreofficekit_hook_2() calls lo_destroy(gImpl)
(desktop/source/lib/init.cxx, around line 8446 at 26.8.1.1). lo_destroy()
starts with a SolarMutexClearableGuard, which needs the SalInstance. If
initialisation failed before InitVCL(), for example on a UNO bootstrap
exception, there is no SalInstance yet. The process then crashes with SIGSEGV
instead of the hook returning NULL:

    SalInstance::GetYieldMutex()   salinst.cxx
    lo_destroy(LibreOfficeKitStruct*)   init.cxx
    libreofficekit_hook_2

The only trace of the real cause is the "Bootstrapping exception ..." line that
lo_initialize() prints to stderr just before.

Observed with LibreOfficeKit on Android arm64 (Pixel 8, Android 17, NDK r28c).
The code path is not platform specific. It is unchanged on master as of
2026-10-15.

Steps to Reproduce:
1. Make lo_initialize() fail before VCL starts. One way: an Android LOK build
linked with native-code.py -g core -g writer only (see bug 174043), so UNO
bootstrap throws.
2. Call libreofficekit_hook_2(install_path, user_profile_url).

Actual Results:
SIGSEGV in SalInstance::GetYieldMutex(), called from lo_destroy() inside
libreofficekit_hook_2().

Expected Results:
libreofficekit_hook_2() returns NULL so the caller can report the failure.
Alternatively, lo_destroy() skips the VCL teardown when VCL was never
initialised.

Reproducible: Always

Additional Info:
Related but different: bug 115657 is about C++ exceptions escaping
libreofficekit_hook_2. Here the exception is caught, and the crash comes from
the cleanup afterwards.


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=168467
[Bug 168467] [META] LibreOfficeKit issues
-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to