Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-859

SIGSEGV in localedef on invalid Unicode character

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.2.0
    • 4.2.2
    • Utilities
    • None
    • Runtime Error

    Description

      The localedef utility crashes on the invalid locale definition file below:

      $ 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
      

      The stack trace:

      (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, 
          start_sym=@0x7ffffed7e890, end_sym=@0x7ffffed7e200, 
          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 (std_src=@0x7ffffed7ff60, 
          std_cmap=@0x7ffffed7ff50, outdir=@0x7ffffed7ff40, 
          std_locale=@0x7ffffed7ff30, 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
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebor Martin Sebor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified