Bug 11280 - Windres segfault on Open Solaris with default codepage
Summary: Windres segfault on Open Solaris with default codepage
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.20
: P2 normal
Target Milestone: ---
Assignee: Dave Korn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-13 11:45 UTC by Tony Theodore
Modified: 2010-02-17 13:37 UTC (History)
1 user (show)

See Also:
Host: i386-pc-solaris2.11
Target: i686-pc-mingw32
Build: i386-pc-solaris2.11
Last reconfirmed:


Attachments
File required to reproduce error (9.95 KB, application/octet-stream)
2010-02-13 11:47 UTC, Tony Theodore
Details
File required to reproduce error (4.84 KB, application/octet-stream)
2010-02-13 11:48 UTC, Tony Theodore
Details
File required to reproduce error (1.11 KB, application/octet-stream)
2010-02-13 11:48 UTC, Tony Theodore
Details
core dump (888.94 KB, application/x-7z-compressed)
2010-02-13 12:25 UTC, Tony Theodore
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Theodore 2010-02-13 11:45:50 UTC
Hello,

After some investigation and help
(http://sourceware.org/ml/binutils/2010-02/msg00111.html), I've been able to
simplify this problem.

On Open Solaris 2009.06 i386, GCC 3.4.3 or GCC 4.3.2, with Binutils 2.20
configured as:

./configure --target='i686-pc-mingw32' --prefix='/export/home/tony/usr'

Windres segfaults when running this command (with pthread.h, version.rc, and
winver.h in .):

i686-pc-mingw32-windres --include-dir=. --preprocessor="gcc -E -xc -DRC_INVOKED"
version.rc version.o

The gdb output:

Starting program: /export/home/tony/usr/bin/i686-pc-mingw32-windres
--include-dir=. --preprocessor=gcc\ -E\ -xc\ -DRC_INVOKED version.rc version.o

Program received signal SIGSEGV, Segmentation fault.
0xcea46832 in iconv () from /lib/libc.so.1
#0  0xcea46832 in iconv () from /lib/libc.so.1
#1  0x08071dbd in iconv_onechar (cd=0xffffffff, s=0x8105390 "FileDescription", 
    d=0x8046960 "\022", d_len=32, n_s=0xffffffff, n_d=0xffffffff)
    at winduni.c:633
#2  0x08071fc3 in wind_MultiByteToWideChar (cp=4294967295, 
    mb=0x8105390 "FileDescription", u=0x0, u_len=0) at winduni.c:694
#3  0x08072052 in unicode_from_codepage (length=0x0, u=0x8105390, 
    src=0x8105390 "FileDescription", cp=0) at winduni.c:584
#4  0x080720ae in unicode_from_ascii (length=0x0, unicode=0x8046a48, 
    ascii=0x8105390 "FileDescription") at winduni.c:194
#5  0x0806e74f in yyparse () at rcparse.y:1703
#6  0x08064c2e in read_rc_file (filename=0x8047b1d "version.rc", 
    preprocessor=0x8047b05 "gcc -E -xc -DRC_INVOKED", 
    preprocargs=0x8107170 "-I.", language=1033, use_temp_file=0) at resrc.c:562
#7  0x08063aee in main (argc=5, argv=0x8047990) at windres.c:1025
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.

If a codepage is specified via the -c option or by defining the macro CP_ACP in
binutils/winduni.h, the segfault no longer occurs.

I've attached the three files and also the core dump.

Please let me know if I can provide any further details.

Thanks,

Tony
Comment 1 Tony Theodore 2010-02-13 11:47:55 UTC
Created attachment 4597 [details]
File required to reproduce error
Comment 2 Tony Theodore 2010-02-13 11:48:24 UTC
Created attachment 4598 [details]
File required to reproduce error
Comment 3 Tony Theodore 2010-02-13 11:48:40 UTC
Created attachment 4599 [details]
File required to reproduce error
Comment 4 Tony Theodore 2010-02-13 12:25:11 UTC
Created attachment 4600 [details]
core dump
Comment 5 Tony Theodore 2010-02-13 12:31:14 UTC
BTW, this only affect 2.20, 2.19 still works fine
Comment 6 Dave Korn 2010-02-14 23:43:01 UTC
Mine :)
Comment 7 cvs-commit@gcc.gnu.org 2010-02-15 19:25:58 UTC
Subject: Bug 11280

CVSROOT:	/cvs/src
Module name:	src
Changes by:	davek@sourceware.org	2010-02-15 19:25:47

Modified files:
	bfd            : configure.host ChangeLog 

Log message:
	bfd/ChangeLog:
	
	PR binutils/11280
	* configure.host (*-*-solaris2.11):  Add host define to select
	valid default code page for windres/windmc on solaris.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/configure.host.diff?cvsroot=src&r1=1.17&r2=1.18
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.4932&r2=1.4933

Comment 8 cvs-commit@gcc.gnu.org 2010-02-17 13:37:07 UTC
Subject: Bug 11280

CVSROOT:	/cvs/src
Module name:	src
Branch: 	binutils-2_20-branch
Changes by:	davek@sourceware.org	2010-02-17 13:36:54

Modified files:
	bfd            : configure.host ChangeLog 

Log message:
	bfd/ChangeLog:
	
	PR binutils/11280
	* configure.host (*-*-solaris2.11):  Add host define to select
	valid default code page for windres/windmc on solaris.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/configure.host.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.17&r2=1.17.54.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.4761.2.42&r2=1.4761.2.43

Comment 9 Dave Korn 2010-02-17 13:37:38 UTC
Fixed on mainline and branch.