https://bugs.documentfoundation.org/show_bug.cgi?id=167633
Bug ID: 167633
Summary: LibreOffice debug build crashed on launch when a Java
installation with a non-ASCII path is set during
configure(rtl_uString_newFromAscii(rtl_uString**,
const char*): Assertion `static_cast<unsig ned
char>(*pCharStr) < 0x80' failed.)
Product: LibreOffice
Version: unspecified
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: LibreOffice
Assignee: [email protected]
Reporter: [email protected]
Description:
Encountered this crash on my development host, where I have a JDK installation
at ~/應用軟體/jdk24 (應用軟體 stands for "Applications").
This crash isn't produced on a release build, nor is it reproduced when I set
--with-jdk-home to /usr/lib/jvm, so the path seems to be hardcoded during build
configuration.
After attaching it to a debugger:
```text
(gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)
at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>) at
./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at
./nptl/pthread_kill.c:89
#3 0x00007ffff784527e in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#4 0x00007ffff78288ff in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff782881b in __assert_fail_base (fmt=0x7ffff79d01e8 "%s%s%s:%u:
%s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x7ffff7cefee8 "static_cast<unsigned
char>(*pCharStr) < 0x80",
file=file@entry=0x7ffff7cefcf0 "/libo-core/sal/rtl/ustring.cxx",
line=line@entry=243,
function=function@entry=0x7ffff7cefe50 "void
rtl_uString_newFromAscii(rtl_uString**, const char*)")
at ./assert/assert.c:96
#6 0x00007ffff783b517 in __assert_fail (assertion=0x7ffff7cefee8
"static_cast<unsigned char>(*pCharStr) < 0x80",
file=0x7ffff7cefcf0 "/libo-core/sal/rtl/ustring.cxx", line=243,
function=0x7ffff7cefe50 "void rtl_uString_newFromAscii(rtl_uString**, const
char*)") at ./assert/assert.c:105
#7 0x00007ffff7c66de4 in rtl_uString_newFromAscii (ppThis=0x7fffffffbef8,
pCharStr=0x7fffffffbf8c
"應用軟體/jdk-24/lib/amd64/client:/home/brlin/應用軟體/jdk-24/lib/amd64/server:/home/brlin/應用軟體/jdk-24/lib/amd64/native_threads:/home/brlin/應用軟體/jdk-24/lib/amd64")
at /libo-core/sal/rtl/ustring.cxx:243
#8 0x000055555555d71d in extend_library_path (
new_element=0x7fffffffbf80
"/home/brlin/應用軟體/jdk-24/lib/amd64/client:/home/brlin/應用軟體/jdk-24/lib/amd64/server:/home/brlin/應用軟體/jdk-24/lib/amd64/native_threads:/home/brlin/應用軟體/jdk-24/lib/amd64")
at /libo-core/desktop/unx/source/start.c:590
#9 0x000055555555dbd5 in exec_javaldx (args=0x5555555aeb80) at
/libo-core/desktop/unx/source/start.c:701
#10 0x000055555555e070 in sal_main_with_args (argc=1, argv=0x7fffffffd2c8)
at /libo-core/desktop/unx/source/start.c:829
#11 0x000055555555dd2c in main (argc=1, argv=0x7fffffffd2c8) at
/libo-core/desktop/unx/source/start.c:744
```
, I can pinpoint the exact function call that triggered the crash:
```c++
// desktop/unx/source/start.c
static void extend_library_path(const char *new_element)
{
rtl_uString *pEnvName=NULL, *pOrigEnvVar=NULL, *pNewEnvVar=NULL;
rtl_uString_newFromAscii(&pEnvName, "LD_LIBRARY_PATH");
rtl_uString_newFromAscii(&pNewEnvVar, new_element); // <- this one
...stripped...
}
```
It appears that the one who designs the logic wrongly assumes that the
LD_LIBRARY_PATH environment variable can only contain ASCII characters.
A patch has been made, stay tuned.
Steps to Reproduce:
1. Install a JDK under a non-ASCII path(e.g. ~/軟體/jdk-24).
2. Set JAVA_HOME and PATH environment variables to point to the JDK
installation ("~/軟體/jdk-24", and "~/軟體/jdk-24/bin").
3. Build LibreOffice with the `--with-dbgutil` configure option.
4. Run the `./instdir/program/soffice --writer` or `./instdir/program/oosplash`
command (./instdir/program/soffice.bin and ./instdir/program/soffice
--backtrace will _not_ work).
Actual Results:
No crash.
Expected Results:
The program aborted with the following error message:
```text
$ ./instdir/program/soffice
oosplash: /libo-core/sal/rtl/ustring.cxx:243: void
rtl_uString_newFromAscii(rtl_uString**, const char*): Assertion
`static_cast<unsigned char>(*pCharStr) < 0x80' failed.
Aborted (core dumped)
```
Reproducible: Always
User Profile Reset: Yes
Additional Info:
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6381d366672234d899eeff278870cfb1c5d100e9
CPU threads: 16; OS: Linux 6.11; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.