> On Fri, 5 Sep 2008 21:27:09 +1000
> Mark Wright <[EMAIL PROTECTED]> wrote:
> 
> Anyway I was wondering if it might help to make the
> just_in_case_buf buffer large to try to work around Solaris 10's
> strxfrm() insanity?

The trouble with that idea though is the concern that strxfrm()
on Solaris 10u5 may still overwrite past the end of the buffer
no matter how large I made just_in_case_buf.

So I instead propose this fix:

goanna% diff -wc stdcxx-4.2.1/src/orig/collate.cpp stdcxx-4.2.1/src/collate.cpp
*** stdcxx-4.2.1/src/orig/collate.cpp   2008-04-25 10:25:19.000000000 +1000
--- stdcxx-4.2.1/src/collate.cpp        2008-09-05 22:00:05.074726012 +1000
***************
*** 522,531 ****
--- 522,537 ----
              src    += (last - src) + 1;
          }
  
+ #if defined(__sun) && defined(__SVR4)
+         // Solaris 10u5 overwrites memory past the end of
+         // just_in_case_buf[8], to avoid this, pass a 0 pointer
+         char *just_in_case_buf = (char *)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
goanna% 

I tested this with my test program on Solaris 10u5 with
Sun Studio 12 C++, it works fine.

Thanks very much, Mark

-- 

Reply via email to