Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Mar 2013 07:58:29 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r248787 - stable/9/lib/libc/stdtime
Message-ID:  <201303270758.r2R7wT8Y011492@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Mar 27 07:58:29 2013
New Revision: 248787
URL: http://svnweb.freebsd.org/changeset/base/248787

Log:
  MFC r248672:
  
  Compile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it relies
  on signed integer overflow wrapping.  Otherwise mktime(3) and timegm(3)
  can hang, in case the timestamp passed in struct tm is not representable
  in a time_t.  Specifically, any timestamp after 2038-01-19 03:14:07, in
  combination with a 32-bit time_t.
  
  Note that it would be better to change the code to not rely on undefined
  behaviour, but it is contributed code, and it is not entirely trivial to
  fix the issue properly.

Modified:
  stable/9/lib/libc/stdtime/Makefile.inc
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/stdtime/Makefile.inc
==============================================================================
--- stable/9/lib/libc/stdtime/Makefile.inc	Wed Mar 27 07:30:08 2013	(r248786)
+++ stable/9/lib/libc/stdtime/Makefile.inc	Wed Mar 27 07:58:29 2013	(r248787)
@@ -11,6 +11,9 @@ SYM_MAPS+= ${.CURDIR}/stdtime/Symbol.map
 
 CFLAGS+= -I${.CURDIR}/../../contrib/tzcode/stdtime -I${.CURDIR}/stdtime
 
+CFLAGS.localtime.c= -fwrapv
+CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
+
 MAN+=	ctime.3 strftime.3 strptime.3 time2posix.3
 MAN+=	tzfile.5
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303270758.r2R7wT8Y011492>