Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 85964 invoked from network); 26 Aug 2006 22:18:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Aug 2006 22:18:36 -0000 Received: (qmail 68061 invoked by uid 500); 26 Aug 2006 22:18:36 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 68040 invoked by uid 500); 26 Aug 2006 22:18:36 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 68027 invoked by uid 99); 26 Aug 2006 22:18:36 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Aug 2006 15:18:35 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Aug 2006 15:18:35 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C506341000C for ; Sat, 26 Aug 2006 22:15:22 +0000 (GMT) Message-ID: <12932867.1156630522789.JavaMail.jira@brutus> Date: Sat, 26 Aug 2006 15:15:22 -0700 (PDT) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Commented: (STDCXX-280) SIGABRT in codecvt::out() In-Reply-To: <14063955.1156629202274.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/STDCXX-280?page=comments#action_12430795 ] Martin Sebor commented on STDCXX-280: ------------------------------------- Another test case with more detail and stack trace showing that the problem originates in wcsrtombs(): $ cat u.cpp && nice make u && LC_ALL=zh_CN.UTF-8@pinyin gdb -q ./u #include #include #include #include #include #include int main () { typedef std::codecvt CodeCvt; const std::locale loc (""); const CodeCvt &cvt = std::use_facet(loc); CodeCvt::state_type state = { }; const int pagesize = getpagesize (); void* const addr = mmap (0, 2 * pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); assert (MAP_FAILED != addr); wchar_t* const from = (wchar_t*)addr + pagesize / sizeof (wchar_t) - 1; const wchar_t* const from_end = from + 1; const wchar_t* from_next = 0; from [0] = L'\n'; from [1] = L'\377'; assert (0 == mprotect (addr, pagesize, PROT_READ)); assert (0 == mprotect (from + 1, pagesize, PROT_NONE)); char to [40]; char* const to_limit = to + sizeof to; char* to_next = 0; CodeCvt::result res; res = cvt.out (state, from, from_end, from_next, to, to_limit, to_next); assert (cvt.ok == res); assert (from_next == from_end); assert (to_next == to + 1); assert ('\n' == *to); } gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include -I/build/sebor/dev/stdlib/tests/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long u.cpp u.cpp: In function 'int main()': u.cpp:15: warning: missing initializer for member '__mbstate_t::__filler' gcc u.o -o u -L/build/sebor/gcc-4.1.0-11s/rwtest -lrwtest11s -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s -lsupc++ -lm (gdb) run Starting program: /build/sebor/gcc-4.1.0-11s/tests/u Program received signal SIGSEGV, Segmentation fault. 0xff2533c4 in __wcsrtombs_dense_utf8 () from /usr/lib/locale/zh.UTF-8/methods_zh.UTF-8.so.2 (gdb) bt #0 0xff2533c4 in __wcsrtombs_dense_utf8 () from /usr/lib/locale/zh.UTF-8/methods_zh.UTF-8.so.2 #1 0x0005b764 in __rw_libc_do_out (state=@0xffbffa50, from=0xff361ffc, from_end=0xff362000, from_next=@0xffbffa4c, to=0xffbffa20 "\n", to_limit=0xffbffa48 " 6\037", to_next=@0xffbffa48) at /build/sebor/dev/stdlib/src/wcodecvt.cpp:535 #2 0x0005c1f0 in std::codecvt_byname::do_out ( this=0xce370, state=@0xffbffa50, from=0xff361ffc, from_end=0xff362000, from_next=@0xffbffa4c, to=0xffbffa20 "\n", to_limit=0xffbffa48 " 6\037", to_next=@0xffbffa48) at /build/sebor/dev/stdlib/src/wcodecvt.cpp:1583 #3 0x0001259c in std::codecvt::out (this=0xce370, __state=@0xffbffa50, __from=0xff361ffc, __from_end=0xff362000, __from_next=@0xffbffa4c, __to=0xffbffa20 "\n", __to_limit=0xffbffa48 " 6\037", __to_next=@0xffbffa48) at _codecvt.h:342 #4 0x0001241c in main () at u.cpp:42 > SIGABRT in codecvt::out() > ------------------------- > > Key: STDCXX-280 > URL: http://issues.apache.org/jira/browse/STDCXX-280 > Project: C++ Standard Library > Issue Type: Bug > Components: 22. Localization > Affects Versions: 4.1.2, 4.1.3 > Environment: all > Reporter: Martin Sebor > Priority: Critical > > The program below aborts on Solaris 9: > $ cat u.cpp && make u && LC_ALL=zh_CN.UTF-8@pinyin ./u > #include > #include > #include > int main () > { > typedef std::codecvt CodeCvt; > const std::locale loc (""); > const CodeCvt &cvt = std::use_facet(loc); > CodeCvt::state_type state = { }; > const wchar_t* const from = L"\n\377"; > const wchar_t* const from_end = from + 1; > const wchar_t* from_next = 0; > char to [40]; > char* const to_limit = to + sizeof to; > char* to_next = 0; > CodeCvt::result res; > res = cvt.out (state, from, from_end, from_next, to, to_limit, to_next); > assert (cvt.ok == res); > assert (from_next == from_end); > assert (to_next == to + 1); > assert ('\n' == *to); > } > gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include -I/build/sebor/dev/stdlib/tests/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long u.cpp > u.cpp: In function 'int main()': > u.cpp:11: warning: missing initializer for member '__mbstate_t::__filler' > gcc u.o -o u -L/build/sebor/gcc-4.1.0-11s/rwtest -lrwtest11s -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s -lsupc++ -lm > /build/sebor/dev/stdlib/src/wcodecvt.cpp:496: std::codecvt_base::result __rw::__rw_libc_do_out(__mbstate_t&, const wchar_t*, const wchar_t*, const wchar_t*&, char*, char*, char*&): Assertion 'from_next <= from_end' failed. > Segmentation Fault (core dumped) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira