aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2013-02-05 14:40:39 +0100
committerAndreas Schwab <schwab@suse.de>2013-06-05 10:33:02 +0200
commit840e2943e8ae020adfa7eafa7877f004e7ecada1 (patch)
tree182c81013a8f79d541a1c01c95a695ffdfb9dd66
parent4c60cb0c8329dd498e9cce3735e5ee6212ad28f4 (diff)
downloadglibc-840e2943e8ae020adfa7eafa7877f004e7ecada1.zip
glibc-840e2943e8ae020adfa7eafa7877f004e7ecada1.tar.gz
glibc-840e2943e8ae020adfa7eafa7877f004e7ecada1.tar.bz2
Properly handle %W in strptime
-rw-r--r--ChangeLog7
-rw-r--r--NEWS12
-rw-r--r--time/strptime_l.c4
-rw-r--r--time/tst-strptime.c1
4 files changed, 16 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 69f3b9f..9a2a0c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-06-05 Andreas Schwab <schwab@suse.de>
+
+ [BZ #15100]
+ * time/strptime_l.c (__strptime_internal): Count Sunday in a %W
+ week as 6 instead of -1.
+ * time/tst-strptime.c (day_tests): Add test case.
+
2013-06-05 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/generic/math_private.h
diff --git a/NEWS b/NEWS
index 9452cc1..3068b78 100644
--- a/NEWS
+++ b/NEWS
@@ -14,12 +14,12 @@ Version 2.18
14293, 14317, 14327, 14478, 14496, 14582, 14686, 14812, 14888, 14894,
14908, 14920, 14952, 14964, 14981, 14982, 14985, 14994, 14996, 15000,
15003, 15006, 15007, 15014, 15020, 15023, 15036, 15054, 15055, 15062,
- 15078, 15084, 15085, 15086, 15160, 15214, 15221, 15232, 15234, 15283,
- 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330, 15335, 15336,
- 15337, 15339, 15342, 15346, 15359, 15361, 15366, 15380, 15381, 15394,
- 15395, 15405, 15406, 15409, 15416, 15418, 15419, 15423, 15424, 15426,
- 15429, 15441, 15442, 15448, 15465, 15480, 15485, 15488, 15490, 15493,
- 15497, 15506, 15529, 15536, 15553.
+ 15078, 15084, 15085, 15086, 15100, 15160, 15214, 15221, 15232, 15234,
+ 15283, 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330, 15335,
+ 15336, 15337, 15339, 15342, 15346, 15359, 15361, 15366, 15380, 15381,
+ 15394, 15395, 15405, 15406, 15409, 15416, 15418, 15419, 15423, 15424,
+ 15426, 15429, 15441, 15442, 15448, 15465, 15480, 15485, 15488, 15490,
+ 15493, 15497, 15506, 15529, 15536, 15553.
* CVE-2013-0242 Buffer overrun in regexp matcher has been fixed (Bugzilla
#15078).
diff --git a/time/strptime_l.c b/time/strptime_l.c
index 1f2e8b6..00fc1ef 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -1180,8 +1180,8 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
if (!s.have_yday)
tm->tm_yday = ((7 - (tm->tm_wday - w_offset)) % 7
- + (s.week_no - 1) *7
- + save_wday - w_offset);
+ + (s.week_no - 1) * 7
+ + (save_wday - w_offset + 7) % 7);
if (!s.have_mday || !s.have_mon)
{
diff --git a/time/tst-strptime.c b/time/tst-strptime.c
index 12b084d..21fbb63 100644
--- a/time/tst-strptime.c
+++ b/time/tst-strptime.c
@@ -41,6 +41,7 @@ static const struct
{ "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 },
{ "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 },
{ "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 },
+ { "C", "2012 00 Sun", "%Y %W %a", 0, 0, 0, 1 },
{ "ja_JP.EUC-JP", "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p",
6, 0, 0, 1 },
{ "en_US.ISO-8859-1", "2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p",