Properly handle %W in strptime

This commit is contained in:
Andreas Schwab 2013-02-05 14:40:39 +01:00
parent 4c60cb0c83
commit 840e2943e8
4 changed files with 16 additions and 8 deletions

View File

@ -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

12
NEWS
View File

@ -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).

View File

@ -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)
{

View File

@ -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",