Return-Path: Delivered-To: apmail-stdcxx-commits-archive@www.apache.org Received: (qmail 94026 invoked from network); 5 Sep 2008 16:01:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Sep 2008 16:01:14 -0000 Received: (qmail 37357 invoked by uid 500); 5 Sep 2008 16:01:12 -0000 Delivered-To: apmail-stdcxx-commits-archive@stdcxx.apache.org Received: (qmail 37339 invoked by uid 500); 5 Sep 2008 16:01:12 -0000 Mailing-List: contact commits-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list commits@stdcxx.apache.org Received: (qmail 37330 invoked by uid 99); 5 Sep 2008 16:01:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 09:01:12 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 16:00:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 70FF7238899E; Fri, 5 Sep 2008 09:00:23 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r692472 - /stdcxx/branches/4.2.x/src/collate.cpp Date: Fri, 05 Sep 2008 16:00:23 -0000 To: commits@stdcxx.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080905160023.70FF7238899E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebor Date: Fri Sep 5 09:00:22 2008 New Revision: 692472 URL: http://svn.apache.org/viewvc?rev=692472&view=rev Log: 2008-09-05 Martin Sebor STDCXX-1010 * src/collate.cpp [_RWSTD_OS_SUNOS] (__rw_strnxfrm): Passed NULL to strxfrm() on Solaris to avoid memory corruption due to a bug in some releases of the OS. [_RWSTD_OS_SUNOS] (__rw_wcsnxfrm): Same but for wcsxfrm(). Modified: stdcxx/branches/4.2.x/src/collate.cpp Modified: stdcxx/branches/4.2.x/src/collate.cpp URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/collate.cpp?rev=692472&r1=692471&r2=692472&view=diff ============================================================================== --- stdcxx/branches/4.2.x/src/collate.cpp (original) +++ stdcxx/branches/4.2.x/src/collate.cpp Fri Sep 5 09:00:22 2008 @@ -522,10 +522,17 @@ src += (last - src) + 1; } +#ifdef _RWSTD_OS_SUNOS + // Solaris 10u5 on AMD64 overwrites memory past the end of + // just_in_case_buf[8], to avoid this, pass a null pointer + char* const just_in_case_buf = 0; +#else // provide a destination buffer to strxfrm() in case // it's buggy (such as MSVC's) and tries to write to // the buffer even if it's 0 char just_in_case_buf [8]; +#endif + const _RWSTD_SIZE_T dst_size = strxfrm (just_in_case_buf, psrc, 0); // check for strxfrm() errors @@ -724,10 +731,16 @@ src += (last - src) + 1; } +#ifdef _RWSTD_OS_SUNOS + // just in case Solaris wcsxfrm() has the same bug + // as its strxfrm() (see above) + wchar_t* const just_in_case_buf = 0; +#else // provide a destination buffer to strxfrm() in case // it's buggy (such as MSVC's) and tries to write to // the buffer even if it's 0 wchar_t just_in_case_buf [8]; +#endif const _RWSTD_SIZE_T dst_size = _RWSTD_WCSXFRM (just_in_case_buf, psrc, 0);