SHA256
1
0
forked from pool/glibc
glibc/strptime-W-week.patch
Andreas Schwab 8715963849 Accepting request 175892 from home:Andreas_Schwab:Factory
- big5-hkscs-update.patch.bz2: Update BIG5-HKSCS charmap to HKSCS-2008
- digits-dots.patch: Fix parsing of numeric hosts in gethostbyname_r
- nss-database.patch: Properly cache the result from looking up the nss
  database config
- strptime-W-week.patch: Properly handle %W in strptime
- printf-overrun.patch: Revert problematic fixes for [BZ #11741]
- glibc-aarch64-lib64.patch: Replace with upstream version
- arm-ld-so-cache.patch: ARM: Support loading unmarked objects from cache
- rtlddir.patch: Add support for rtld directory different from slib
  directory
- regexp-overrun.patch: Fix buffer overrun in regexp matcher
  (CVE-2013-0242, bnc#801246)
- getaddrinfo-overflow.patch: Fix stack overflow in getaddrinfo with many
  results (CVE-2013-1914, bnc#813121)

- big5-hkscs-update.patch.bz2: Update BIG5-HKSCS charmap to HKSCS-2008
- digits-dots.patch: Fix parsing of numeric hosts in gethostbyname_r
- nss-database.patch: Properly cache the result from looking up the nss
  database config
- strptime-W-week.patch: Properly handle %W in strptime
- printf-overrun.patch: Revert problematic fixes for [BZ #11741]
- glibc-aarch64-lib64.patch: Replace with upstream version
- arm-ld-so-cache.patch: ARM: Support loading unmarked objects from cache
- rtlddir.patch: Add support for rtld directory different from slib
  directory
- regexp-overrun.patch: Fix buffer overrun in regexp matcher
  (CVE-2013-0242, bnc#801246)
- getaddrinfo-overflow.patch: Fix stack overflow in getaddrinfo with many
  results (CVE-2013-1914, bnc#813121)

OBS-URL: https://build.opensuse.org/request/show/175892
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=284
2013-05-16 15:57:30 +00:00

45 lines
1.5 KiB
Diff

From 3cc4f772e4e1a0999bf9a51a585c35d6f60421b6 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Tue, 5 Feb 2013 14:40:39 +0100
Subject: [PATCH] Properly handle %W in strptime
[BZ #15100]
* time/strptime_l.c (__strptime_internal): Count Sunday in a %W
week as 6 instead of -1.
* tst-strptime.c (day_tests): Add test case.
---
time/strptime_l.c | 4 ++--
time/tst-strptime.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
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",
--
1.8.2.3