mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Fixed a bad pointer comparison in g_ascii_strtod that came up in fa_IR
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu> * glib/gstrfuncs.c: Fixed a bad pointer comparison in g_ascii_strtod that came up in fa_IR locale (#126640, Behdad Esfahbod). * tests/strtod-test.c: Fixed the tests to catch the above.
This commit is contained in:
parent
94d79f087b
commit
6e3b71aec3
@ -1,3 +1,11 @@
|
||||
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
|
||||
|
||||
* glib/gstrfuncs.c: Fixed a bad pointer comparison in
|
||||
g_ascii_strtod that came up in fa_IR locale (#126640, Behdad
|
||||
Esfahbod).
|
||||
|
||||
* tests/strtod-test.c: Fixed the tests to catch the above.
|
||||
|
||||
Sat Nov 22 14:16:51.15 2003 Andrew Lanoix <alanoix@umich.edu>
|
||||
|
||||
* glib/giowin32.c: Bind inter-thread comminication
|
||||
|
@ -1,3 +1,11 @@
|
||||
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
|
||||
|
||||
* glib/gstrfuncs.c: Fixed a bad pointer comparison in
|
||||
g_ascii_strtod that came up in fa_IR locale (#126640, Behdad
|
||||
Esfahbod).
|
||||
|
||||
* tests/strtod-test.c: Fixed the tests to catch the above.
|
||||
|
||||
Sat Nov 22 14:16:51.15 2003 Andrew Lanoix <alanoix@umich.edu>
|
||||
|
||||
* glib/giowin32.c: Bind inter-thread comminication
|
||||
|
@ -1,3 +1,11 @@
|
||||
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
|
||||
|
||||
* glib/gstrfuncs.c: Fixed a bad pointer comparison in
|
||||
g_ascii_strtod that came up in fa_IR locale (#126640, Behdad
|
||||
Esfahbod).
|
||||
|
||||
* tests/strtod-test.c: Fixed the tests to catch the above.
|
||||
|
||||
Sat Nov 22 14:16:51.15 2003 Andrew Lanoix <alanoix@umich.edu>
|
||||
|
||||
* glib/giowin32.c: Bind inter-thread comminication
|
||||
|
@ -1,3 +1,11 @@
|
||||
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
|
||||
|
||||
* glib/gstrfuncs.c: Fixed a bad pointer comparison in
|
||||
g_ascii_strtod that came up in fa_IR locale (#126640, Behdad
|
||||
Esfahbod).
|
||||
|
||||
* tests/strtod-test.c: Fixed the tests to catch the above.
|
||||
|
||||
Sat Nov 22 14:16:51.15 2003 Andrew Lanoix <alanoix@umich.edu>
|
||||
|
||||
* glib/giowin32.c: Bind inter-thread comminication
|
||||
|
@ -1,3 +1,11 @@
|
||||
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
|
||||
|
||||
* glib/gstrfuncs.c: Fixed a bad pointer comparison in
|
||||
g_ascii_strtod that came up in fa_IR locale (#126640, Behdad
|
||||
Esfahbod).
|
||||
|
||||
* tests/strtod-test.c: Fixed the tests to catch the above.
|
||||
|
||||
Sat Nov 22 14:16:51.15 2003 Andrew Lanoix <alanoix@umich.edu>
|
||||
|
||||
* glib/giowin32.c: Bind inter-thread comminication
|
||||
|
@ -1,3 +1,11 @@
|
||||
Wed Nov 26 16:45:16 2003 Roozbeh Pournader <roozbeh@sharif.edu>
|
||||
|
||||
* glib/gstrfuncs.c: Fixed a bad pointer comparison in
|
||||
g_ascii_strtod that came up in fa_IR locale (#126640, Behdad
|
||||
Esfahbod).
|
||||
|
||||
* tests/strtod-test.c: Fixed the tests to catch the above.
|
||||
|
||||
Sat Nov 22 14:16:51.15 2003 Andrew Lanoix <alanoix@umich.edu>
|
||||
|
||||
* glib/giowin32.c: Bind inter-thread comminication
|
||||
|
@ -433,7 +433,7 @@ g_ascii_strtod (const gchar *nptr,
|
||||
|
||||
if (fail_pos)
|
||||
{
|
||||
if (fail_pos > decimal_point_pos)
|
||||
if (fail_pos - copy > decimal_point_pos - nptr)
|
||||
fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1);
|
||||
else
|
||||
fail_pos = (char *)nptr + (fail_pos - copy);
|
||||
|
@ -13,6 +13,14 @@ test_string (char *number, double res)
|
||||
char *locales[] = {"sv_SE", "en_US", "fa_IR", "C"};
|
||||
int l;
|
||||
char *end;
|
||||
char *dummy;
|
||||
|
||||
/* we try a copy of number, with some free space for malloc before that.
|
||||
* This is supposed to smash the some wrong pointer calculations. */
|
||||
|
||||
dummy = g_malloc (100000);
|
||||
number = g_strdup (number);
|
||||
g_free (dummy);
|
||||
|
||||
for (l = 0; l < G_N_ELEMENTS (locales); l++)
|
||||
{
|
||||
@ -20,9 +28,11 @@ test_string (char *number, double res)
|
||||
d = g_ascii_strtod (number, &end);
|
||||
if (d != res)
|
||||
g_print ("g_ascii_strtod for locale %s failed\n", locales[l]);
|
||||
if (*end != 0)
|
||||
if (end - number != strlen(number))
|
||||
g_print ("g_ascii_strtod for locale %s endptr was wrong\n", locales[l]);
|
||||
}
|
||||
|
||||
g_free (number);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user