glib r7114 - in branches/glib-2-16: . glib
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7114 - in branches/glib-2-16: . glib
- Date: Mon, 30 Jun 2008 22:37:45 +0000 (UTC)
Author: matthiasc
Date: Mon Jun 30 22:37:45 2008
New Revision: 7114
URL: http://svn.gnome.org/viewvc/glib?rev=7114&view=rev
Log:
Bug 314453 â Nautilus crashes in Solaris when browsing the attached
file
* glib/gunicollate.c (g_utf8_collate_key): Handle strfxrm returning
-1 a little better. Problem pointed out by Takao Fujiwara
Modified:
branches/glib-2-16/ChangeLog
branches/glib-2-16/glib/gunicollate.c
Modified: branches/glib-2-16/glib/gunicollate.c
==============================================================================
--- branches/glib-2-16/glib/gunicollate.c (original)
+++ branches/glib-2-16/glib/gunicollate.c Mon Jun 30 22:37:45 2008
@@ -240,11 +240,16 @@
str_norm = g_utf8_normalize (str, len, G_NORMALIZE_ALL_COMPOSE);
+ result = NULL;
+
if (g_get_charset (&charset))
{
xfrm_len = strxfrm (NULL, str_norm, 0);
- result = g_malloc (xfrm_len + 1);
- strxfrm (result, str_norm, xfrm_len + 1);
+ if (xfrm_len >= 0 && xfrm_len < G_MAXINT - 2)
+ {
+ result = g_malloc (xfrm_len + 1);
+ strxfrm (result, str_norm, xfrm_len + 1);
+ }
}
else
{
@@ -267,14 +272,15 @@
g_free (str_locale);
}
- else
- {
- xfrm_len = strlen (str_norm);
- result = g_malloc (xfrm_len + 2);
- result[0] = 'B';
- memcpy (result + 1, str_norm, xfrm_len);
- result[xfrm_len+1] = '\0';
- }
+ }
+
+ if (!result)
+ {
+ xfrm_len = strlen (str_norm);
+ result = g_malloc (xfrm_len + 2);
+ result[0] = 'B';
+ memcpy (result + 1, str_norm, xfrm_len);
+ result[xfrm_len+1] = '\0';
}
g_free (str_norm);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]