SIGSEGV in localedef on invalid Unicode character
-------------------------------------------------
Key: STDCXX-859
URL: https://issues.apache.org/jira/browse/STDCXX-859
Project: C++ Standard Library
Issue Type: Bug
Components: Utilities
Affects Versions: 4.2.0
Reporter: Martin Sebor
Priority: Minor
Fix For: 4.2.2
The {{localedef}} utility crashes on the invalid locale definition file below:
{noformat}
$ cat ctype.src && ./localedef -c -w -f ~/stdcxx/etc/nls/charmaps/ISO-8859-1 -i
ctype.src ctype
LC_CTYPE
cntrl <U0000>..<U004>
END LC_CTYPE
Segmentation fault
{noformat}
The stack trace:
{noformat}
(gdb) r -c -w -f ~/stdcxx/etc/nls/charmaps/ISO-8859-1 -i ctype.src ctype
Starting program: /build/sebor/stdcxx-gcc-4.1.2-15D/bin/localedef -c -w -f
~/stdcxx/etc/nls/charmaps/ISO-8859-1 -i ctype.src ctype
[Thread debugging using libthread_db enabled]
[Detaching after fork from child process 5076. (Try `set detach-on-fork off'.)]
[New Thread 46912499609232 (LWP 5073)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912499609232 (LWP 5073)]
0x00002aaaaab1e9d3 in __rw::__rw_memset (dst=0x79c732, c=48,
nbytes=18446744073709475633) at /home/sebor/stdcxx/src/string.cpp:93
93 *tmp = c;
Missing separate debuginfos, use: debuginfo-install gcc.x86_64
(gdb) where
#0 0x00002aaaaab1e9d3 in __rw::__rw_memset (dst=0x79c732, c=48,
nbytes=18446744073709475633) at /home/sebor/stdcxx/src/string.cpp:93
#1 0x00002aaaaab29f14 in std::char_traits<char>::assign (
__s=0x79c732 '0' <repeats 200 times>..., __n=18446744073709551615,
__c=48 '0') at /home/sebor/stdcxx/include/rw/_traits.h:451
#2 0x00002aaaaab2a0bb in std::string::replace (this=0x7ffffed7e0d0, __pos=2,
__len=0, __count=18446744073709551615, __val=48 '0')
at /home/sebor/stdcxx/include/string.cc:432
#3 0x00002aaaaab3c5f3 in std::string::append (this=0x7ffffed7e0d0,
__n=18446744073709551615, __c=48 '0')
at /home/sebor/stdcxx/include/string:1244
#4 0x0000000000452ae4 in Def::process_sym_ellipsis (this=0x7ffffed7e790,
[EMAIL PROTECTED], [EMAIL PROTECTED],
type=Scanner::tok_hex_ellipsis, m=__rw::__rw_cntrl)
at /home/sebor/stdcxx/util/ctype.cpp:260
#5 0x000000000045345a in Def::process_mask (this=0x7ffffed7e790,
m=__rw::__rw_cntrl, name=0x4d2019 "cntrl")
at /home/sebor/stdcxx/util/ctype.cpp:349
#6 0x0000000000453ff2 in Def::process_ctype (this=0x7ffffed7e790)
at /home/sebor/stdcxx/util/ctype.cpp:764
#7 0x000000000045be12 in Def::process_input (this=0x7ffffed7e790)
at /home/sebor/stdcxx/util/def.cpp:495
#8 0x0000000000406b5f in create_locale ([EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED], force_output=true, use_ucs=false,
no_position=false, link_aliases=false)
at /home/sebor/stdcxx/util/localedef.cpp:217
#9 0x0000000000407f26 in localedef_main (argc=8, argv=0x7ffffed800d8)
at /home/sebor/stdcxx/util/localedef.cpp:564
#10 0x0000000000408146 in main (argc=8, argv=0x7ffffed800d8)
at /home/sebor/stdcxx/util/localedef.cpp:596
{noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.