Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#185 closed defect (fixed)

libc: Calling setlocale() from both parent and forked child crashes child

Reported by: ydario Owned by: bird
Priority: normal Milestone: libc-0.6.4
Component: libc Version: 0.6.2
Severity: normal Keywords: setlocale fork crash uconv
Cc:

Description

When setlocale( LC_ALL,"") is called in main program and also in the child forked process, the child crashes in UCONV.DLL

Sample testcase

#include <locale.h>

int local( char* who)
{
printf("%s set locale\n", who);
setlocale( LC_ALL, "");
printf("%s set locale done\n", who);
}

int main( void)
{
int pid;
local("parent");
pid = fork();
if (pid==0)
  local("child");
}

gives the following output

[e:\rd\libc\test\setlocale]local.exe
parent set locale
parent set locale done
child set locale

Killed by SIGSEGV
pid=0x028f ppid=0x028e tid=0x0001 slot=0x00d1 pri=0x0200 mc=0x0001
E:\RD\LIBC\TEST\SETLOCALE\LOCAL.EXE
UCONV 0:00002eb0
cs:eip=005b:1fc82eb0      ss:esp=0053:0012f18c      ebp=0012f1b8
 ds=0053      es=0053      fs=150b      gs=0000     efl=00010206
eax=02500330 ebx=02500330 ecx=00000000 edx=00506220 edi=00000001 esi=0012f23c
Process dumping was disabled, use DUMPPROC / PROCDUMP to enable it.

Change History (2)

comment:1 Changed 12 years ago by bird

  • Resolution set to fixed
  • Status changed from new to closed

(In [3523]) Corrected wrong return code check when recreating the iconv/locale objects in a forked child. Fixes #185.

comment:2 Changed 12 years ago by bird

  • Keywords setlocale fork crash uconv added
  • Summary changed from Calling setlocale() from both parent and forked child crashes child to libc: Calling setlocale() from both parent and forked child crashes child
Note: See TracTickets for help on using tickets.