Description
The following made up LC_MONETARY section causes localedef to die with a SIGSEGV:
$ cat foo.src && ./localedef -w -c -f /nfs/devco/sebor/stdcxx/etc/nls/charmaps/ISO-8859-1 -i foo.src foo || gdb -q ./localedef
LC_MONETARY
int_curr_symbol "ABCD"
currency_symbol "klmn"
mon_decimal_point "@"
mon_thousands_sep "|"
mon_grouping 5
positive_sign "<"
negative_sign ">"
int_frac_digits 6
frac_digits 7
p_cs_precedes 1
p_sep_by_space 1
n_cs_precedes 1
n_sep_by_space 1
p_sign_posn 1
n_sign_posn 2
END LC_MONETARY
Segmentation fault
Using host libthread_db library "/lib64/tls/libthread_db.so.1".
(gdb) run -w -c -f /nfs/devco/sebor/stdcxx/etc/nls/charmaps/ISO-8859-1 -i foo.src foo
Starting program: /build/sebor/stdcxx-gcc-3.4.6-11S/bin/localedef -w -c -f /nfs/devco/sebor/stdcxx/etc/nls/charmaps/ISO-8859-1 -i foo.src foo
Detaching after fork from child process 28327.
Program received signal SIGSEGV, Segmentation fault.
0x00000000004496a8 in Def::convert_string (this=0x7fbfffdda0,
str1=@0x7fbfffdea0) at /amd/devco/sebor/stdcxx/util/def.cpp:286
286 while (str[idx] != '>') {
(gdb) where
#0 0x00000000004496a8 in Def::convert_string (this=0x7fbfffdda0,
str1=@0x7fbfffdea0) at /amd/devco/sebor/stdcxx/util/def.cpp:286
#1 0x000000000045c5d3 in Def::process_monetary (this=0x7fbfffdda0)
at /amd/devco/sebor/stdcxx/util/monetary.cpp:142
#2 0x000000000044a13a in Def::process_input (this=0x7fbfffdda0)
at /amd/devco/sebor/stdcxx/util/def.cpp:502
#3 0x0000000000403c07 in create_locale (std_src=
{<std::allocator<char>> =
{<std::allocator<char>> = {<No data fields>}
, static npos = 18446744073709551615, static _C_null_ref = {<_rw::_string_ref<char,std::char_traits<char>,std::allocator<char> >> = {_C_refs = 0, _C_cap = 0, _C_size = {_C_size = 0, _C_dummy = 0 '\0'}}, _C_eos = 0 '\0'}, _C_data = 0x6a15a8 "/nfs/devco/sebor/stdcxx/etc/nls/charmaps/ISO-8859-1"}, outdir=
{<std::allocator<char>> =
{<std::allocator<char>> = {<No data fields>}
, static npos = 18446744073709551615, static _C_null_ref = {<_rw::_string_ref<char,std::char_traits<char>,std::allocator<char> >> = {_C_refs = 0, _C_cap = 0, _C_size = {_C_size = 0, _C_dummy = 0 '\0'}}, _C_eos = 0 '\0'}, _C_data = 0x6a1558 "foo"}, force_output=true,
use_ucs=false, no_position=false, link_aliases=false)
at /amd/devco/sebor/stdcxx/util/localedef.cpp:210
#4 0x000000000040574f in main (argc=8, argv=0x7fbffff578)
at /amd/devco/sebor/stdcxx/util/localedef.cpp:558