This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [rganesan@myrealbox.com] libc/1632: towupper() segfaults after call to set locale


On Tue, Mar 07, 2000 at 04:41:12PM +0100, Andreas Jaeger wrote:
> 
> Hi glibc folks,
> 
> We've received the appended bug report.  I can reproduce the problem
> after clearing my environment from LANG and LC_ALL.
> 
> Here's an output from gdb:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x400c3ff5 in towupper (wc=65) at wcfuncs.c:97
> 97        return (wint_t) __ctype32_toupper[idx];
> (gdb) p __ctype32_toupper 
> $1 = (__int32_t *) 0x0
> 
> Btw. towlower works fine.
> 

It is a typo. Here is a patch. We should check all the locale
initializations for things like that.


H.J.
---
2000-03-07  H.J. Lu  <hjl@gnu.org>

	* locale/C-ctype.c (_nl_C_LC_CTYPE): Fix the initializer order
	for _NL_CTYPE_TOXXXER32_EX.

Index: locale/C-ctype.c
===================================================================
RCS file: /cvs/glibc/libc/locale/C-ctype.c,v
retrieving revision 1.22.2.4
diff -u -p -r1.22.2.4 C-ctype.c
--- C-ctype.c	2000/02/25 07:00:15	1.22.2.4
+++ C-ctype.c	2000/03/07 16:23:40
@@ -370,13 +370,12 @@ const struct locale_data _nl_C_LC_CTYPE 
     { word: 1 },
     { string: "ANSI_X3.4-1968" },
 #if BYTE_ORDER == LITTLE_ENDIAN
-    { string: NULL },
+    { string: NULL }, { string: NULL },
 #endif
     { string: (const char *) (_nl_C_LC_CTYPE_toupper + 128) },
-    { string: NULL },
     { string: (const char *) (_nl_C_LC_CTYPE_tolower + 128) }
 #if BYTE_ORDER == BIG_ENDIAN
-    , { string: NULL }
+    , { string: NULL }, { string: NULL }
 #endif
   }
 };

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]