[glibc/f20] Fix parsing of 0e+0 as float
Siddhesh Poyarekar
siddhesh at fedoraproject.org
Thu Jan 23 10:23:22 UTC 2014
commit 730a16fa1d93430a0013613be6a5182222ba0c2d
Author: Siddhesh Poyarekar <siddhesh at redhat.com>
Date: Thu Jan 23 15:53:11 2014 +0530
Fix parsing of 0e+0 as float
glibc-rh1055613.patch | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
glibc.spec | 3 ++
2 files changed, 73 insertions(+), 0 deletions(-)
---
diff --git a/glibc-rh1055613.patch b/glibc-rh1055613.patch
new file mode 100644
index 0000000..e9a4a44
--- /dev/null
+++ b/glibc-rh1055613.patch
@@ -0,0 +1,70 @@
+commit a4966c6104918ac884ee1131a4ed23c5ad6b4c5a
+Author: Andreas Schwab <schwab at suse.de>
+Date: Thu Oct 31 12:51:03 2013 +0100
+
+ Fix parsing of 0e+0 as float
+
+diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c
+index 1edb227..3c34f58 100644
+--- a/stdio-common/tst-sscanf.c
++++ b/stdio-common/tst-sscanf.c
+@@ -109,6 +109,19 @@ struct test double_tests[] =
+ { L("-inf"), L("%g"), 1 }
+ };
+
++struct test2
++{
++ const CHAR *str;
++ const CHAR *fmt;
++ int retval;
++ char residual;
++} double_tests2[] =
++{
++ { L("0e+0"), L("%g%c"), 1, 0 },
++ { L("0xe+0"), L("%g%c"), 2, '+' },
++ { L("0x.e+0"), L("%g%c"), 2, '+' },
++};
++
+ int
+ main (void)
+ {
+@@ -196,5 +209,26 @@ main (void)
+ }
+ }
+
++ for (i = 0; i < sizeof (double_tests2) / sizeof (double_tests2[0]); ++i)
++ {
++ double dummy;
++ int ret;
++ char c = 0;
++
++ if ((ret = SSCANF (double_tests2[i].str, double_tests2[i].fmt,
++ &dummy, &c)) != double_tests2[i].retval)
++ {
++ printf ("double_tests2[%d] returned %d != %d\n",
++ i, ret, double_tests2[i].retval);
++ result = 1;
++ }
++ else if (ret == 2 && c != double_tests2[i].residual)
++ {
++ printf ("double_tests2[%d] stopped at '%c' != '%c'\n",
++ i, c, double_tests2[i].residual);
++ result = 1;
++ }
++ }
++
+ return result;
+ }
+diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
+index 78dc2fc..e6fa8f3 100644
+--- a/stdio-common/vfscanf.c
++++ b/stdio-common/vfscanf.c
+@@ -1966,6 +1966,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
+ if (width > 0)
+ --width;
+ }
++ else
++ got_digit = 1;
+ }
+
+ while (1)
diff --git a/glibc.spec b/glibc.spec
index c1d2e0c..c2464fe 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -190,6 +190,7 @@ Patch0043: %{name}-rh1009145.patch
Patch1001: %{name}-rh995841.patch
Patch1002: %{name}-rh1008299.patch
Patch1003: %{name}-rh1047979.patch
+Patch1004: %{name}-rh1055613.patch
#
# Patches submitted, but not yet approved upstream.
@@ -566,6 +567,7 @@ package or when debugging this package.
%patch2032 -p1
%patch0043 -p1
%patch1003 -p1
+%patch1004 -p1
##############################################################################
# %%prep - Additional prep required...
@@ -1654,6 +1656,7 @@ rm -f *.filelist*
* Thu Jan 23 2014 Siddhesh Poyarekar <siddhesh at redhat.com> - 2.18-12
- Use first name entry for address in /etc/hosts as the canonical name
in getaddrinfo (#1047979).
+- Fix parsing of 0e+0 as float (#1055613).
* Wed Oct 2 2013 Carlos O'Donell <carlos at redhat.com> - 2.18-11
- Allow ldconfig cached objects previously marked as hard or soft
More information about the scm-commits
mailing list