Opened 9 years ago

Closed 9 years ago

#3021 closed defect (fixed)

Crash when writing non-ascii character on linux

Reported by: mimo Owned by: philip
Priority: Release Blocker Milestone: Alpha 18
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by leper)

When clicking on the "learn to play" button with the french translation enabled, the game crashes. Using gdb, we get

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff35d2107 in kill () at ../sysdeps/unix/syscall-template.S:81
81      ../sysdeps/unix/syscall-template.S: Aucun fichier ou dossier de ce type.
(gdb) where
#0  0x00007ffff35d2107 in kill () at ../sysdeps/unix/syscall-template.S:81
#1  0x00000000008cd185 in debug_printf (fmt=fmt@entry=0x9f6300 L"ERROR: %hs\n") at ../../../source/lib/debug.cpp:150
#2  0x00000000005ec61f in CLogger::WriteError (this=0xef1e50, 
    message=0x24f0e78 "Invalid tag 'sur' at 7496 in '[font=\"sans-bold-18\"]Manuel intégré 0 A.D.\n[font=\"sans-14\"]\nMerci d'avoir installé 0 A.D. ! Cette page vous donnera un bref aperçu des fonctionnalités disponibles de"...) at ../../../source/ps/CLogger.cpp:172
#3  0x0000000000848111 in CGUIString::SetValue (this=this@entry=0x7fffffffa080, str=...) at ../../../source/gui/GUItext.cpp:395
#4  0x000000000088e039 in JSI_IGUIObject::setProperty (cx=cx@entry=0x2478bc0, obj=..., obj@entry=..., id=..., id@entry=..., vp=vp@entry=...)
    at ../../../source/gui/scripting/JSInterface_IGUIObject.cpp:396
#5  0x00007ffff7129e31 in CallJSPropertyOpSetter (vp=..., strict=true, id=..., obj=..., 
    op=0x88c000 <JSI_IGUIObject::setProperty(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, bool, JS::MutableHandle<JS::Value>)>, cx=0x2478bc0)
    at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs31/js/src/jscntxtinlines.h:323
#6  set (vp=..., strict=<optimized out>, receiver=..., obj=..., cx=0x2478bc0, this=<optimized out>)
    at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs31/js/src/vm/Shape-inl.h:112
#7  js::NativeSet<(js::ExecutionMode)0> (cxArg=<optimized out>, obj=..., receiver=..., shape=..., strict=<optimized out>, vp=...)
    at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs31/js/src/jsobj.cpp:4366
#8  0x00007ffff7117cfd in DefinePropertyOrElement<(js::ExecutionMode)0> (cx=0x2478bc0, obj=..., id=..., 
    getter=0x88a780 <JSI_IGUIObject::getProperty(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS::Value>)>, 
    setter=0x88c000 <JSI_IGUIObject::setProperty(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, bool, JS::MutableHandle<JS::Value>)>, 
    attrs=4294943280, value=..., callSetterAfterwards=true, setterIsStrict=true)
    at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs31/js/src/jsobj.cpp:3764
#9  0x00007ffff712ac21 in js::baseops::SetPropertyHelper<(js::ExecutionMode)0> (cxArg=0x2478bc0, obj=..., receiver=..., id=..., qualified=<optimized out>, 
    vp=..., strict=true) at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs31/js/src/jsobj.cpp:5060
#10 0x00007ffff71f7f64 in setGeneric (strict=<optimized out>, vp=..., id=..., receiver=..., obj=..., cx=<optimized out>)
    at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs31/js/src/jsobj.h:1024
#11 SetPropertyOperation (rval=..., lval=..., pc=<optimized out>, script=..., cx=<optimized out>)
    at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs31/js/src/vm/Interpreter.cpp:340
---Type <return> to continue, or q <return> to quit---

Change History (3)

comment:1 by leper, 9 years ago

Description: modified (diff)

comment:2 by leper, 9 years ago

Priority: Should HaveRelease Blocker

This is related to #3011.

comment:3 by philip, 9 years ago

Owner: set to philip
Resolution: fixed
Status: newclosed

In 16332:

Convert debug_printf to take UTF-8 strings instead of wchar_t.

This fixes the problem where passing a non-ASCII string to debug_printf(L"%hs", s) caused vswprintf_s to fail on Linux (because it doesn't know what encoding the char* is meant to have). Now debug messages will remain as UTF-8 until they reach the OS.

Fixes #3021.

Note: See TracTickets for help on using tickets.