changeset 29976:9a1a37c73eeb

mktime.c: normalize tp->tm_isdst value to -1/0/1. * lib/mktime.c (__mktime_internal): Normalize tp->tm_isdst value. Reported by Michael Ringe <Michael.Ringe@gmx.de> in <http://sourceware.org/bugzilla/show_bug.cgi?id=6723>.
author Ulrich Drepper <drepper@redhat.com>
date Wed, 23 Jul 2008 16:19:15 +0200
parents d545a7e74cd0
children 2bffa79ac8ee
files ChangeLog lib/mktime.c
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jul 23 12:34:14 2008 +0200
+++ b/ChangeLog	Wed Jul 23 16:19:15 2008 +0200
@@ -1,5 +1,10 @@
 2008-07-23  Ulrich Drepper  <drepper@redhat.com>
 
+	mktime.c: normalize tp->tm_isdst value to -1/0/1.
+	* lib/mktime.c (__mktime_internal): Normalize tp->tm_isdst value.
+	Reported by Michael Ringe <Michael.Ringe@gmx.de> in
+	<http://sourceware.org/bugzilla/show_bug.cgi?id=6723>.
+
 	* lib/canonicalize-lgpl.c (__realpath): Avoid buffer overflow after
 	readlink on platforms without PATH_MAX.
 
--- a/lib/mktime.c	Wed Jul 23 12:34:14 2008 +0200
+++ b/lib/mktime.c	Wed Jul 23 16:19:15 2008 +0200
@@ -290,7 +290,9 @@
   int mday = tp->tm_mday;
   int mon = tp->tm_mon;
   int year_requested = tp->tm_year;
-  int isdst = tp->tm_isdst;
+  /* Normalize the value.  */
+  int isdst = ((tp->tm_isdst >> (8 * sizeof (tp->tm_isdst) - 1))
+	       | (tp->tm_isdst != 0));
 
   /* 1 if the previous probe was DST.  */
   int dst2;