> -----Original Message-----
> From: Andrew Black [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 16, 2006 12:03 AM
> To: [email protected]
> Subject: [patch] resolve segv in locale/localedef
>
> Below is a 2 line patch to the locale and localedef utilities
> that resolves a segfault encountered during automated testing
> (and adds a missing newline).  This problem generally shows
> up during stage 2 of the run_locale_utils.sh script.

  See, please, the attached patch.

  Without this patch I got the following diagnostic message
within validate() function (locale.cpp, line 103):
"Error 399: invalid size at 00AE0000: 4294967295, expected 352".

  Platform: Windows.

Farid.

Index: memchk.cpp
===================================================================
--- memchk.cpp  (revision 431866)
+++ memchk.cpp  (working copy)
@@ -2,7 +2,7 @@
  *
  * memchk.cpp - definitions of memory checking helper functions
  *
- * $Id: //stdlib/dev/source/stdlib/util/memchk.cpp#5 $
+ * $Id$
  *
  ***************************************************************************
  *
@@ -107,11 +107,16 @@
 
         // create a temporary file and have Win32 delete it when
         // the last file descriptor that refers to it is closed
-        fd = open (fname, O_RDWR | _O_TEMPORARY, 0666);
+        fd = open (fname, O_RDWR | O_CREAT | _O_TEMPORARY, 0666);
 
         // free storage allocated by tempnam()
         free (fname);
 
+        if (fd < 0) {
+            // error: unable to check addr
+            return size_t (-1);
+        }
+
 #else   // !_WIN{32,64}
 
 #  define TMP_TEMPLATE P_tmpdir "/rwmemchk-XXXXXX"

Reply via email to