Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/glib/ChangeLog,v
retrieving revision 1.1572.2.42
diff -u -2 -r1.1572.2.42 ChangeLog
--- ChangeLog	19 Aug 2004 23:30:17 -0000	1.1572.2.42
+++ ChangeLog	20 Aug 2004 00:02:05 -0000
@@ -1,2 +1,8 @@
+2004-08-20  Tor Lillqvist  <tml@iki.fi>
+
+	* glib/gunicollate.c (g_utf8_collate_key): Guard against bogus
+	return value from strxfrm(). For instance Microsoft's strxfrm()
+	returns INT_MAX on errors.
+
 2004-08-19  Tor Lillqvist  <tml@iki.fi>
 
Index: glib/gunicollate.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gunicollate.c,v
retrieving revision 1.10.2.1
diff -u -2 -r1.10.2.1 gunicollate.c
--- glib/gunicollate.c	19 Aug 2004 23:30:17 -0000	1.10.2.1
+++ glib/gunicollate.c	20 Aug 2004 00:02:05 -0000
@@ -232,4 +232,12 @@
 	{
 	  xfrm_len = strxfrm (NULL, str_locale, 0);
+	  if (xfrm_len < 0 || xfrm_len >= G_MAXINT - 2)
+	    {
+	      g_free (str_locale);
+	      str_locale = NULL;
+	    }
+	}
+      if (str_locale)
+	{
 	  result = g_malloc (xfrm_len + 2);
 	  result[0] = 'A';
