Module Name:    src
Committed By:   kre
Date:           Sat Nov  5 22:21:48 UTC 2016

Modified Files:
        src/lib/libc/time: zic.c

Log Message:
Revert a couple of lines of code from tzcode2016i to their state in 2016h

SIZE_MAX is the max value of a size_t (and is unsigned) so when converted
to a ptrdiff_t  (int) becomes -1.   That's not what the code was attempting
to achieve.

This will be reported upstream to the tzcode maintainers, and we'll see
what variation appears in tzcode2016j ...

Until then, the older code always worked for us, so it will do for now.

This should fix the broken i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/lib/libc/time/zic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/zic.c
diff -u src/lib/libc/time/zic.c:1.65 src/lib/libc/time/zic.c:1.66
--- src/lib/libc/time/zic.c:1.65	Fri Nov  4 19:41:53 2016
+++ src/lib/libc/time/zic.c	Sat Nov  5 22:21:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.65 2016/11/04 19:41:53 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.66 2016/11/05 22:21:48 kre Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.65 2016/11/04 19:41:53 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.66 2016/11/05 22:21:48 kre Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -453,9 +453,13 @@ growalloc(void *ptr, size_t itemsize, pt
 		return ptr;
 	else {
 #define IMAX (INT_MAX < SIZE_MAX ? INT_MAX : (int)SIZE_MAX)
+#if 0
 		ptrdiff_t nitems_max = PTRDIFF_MAX - WORK_AROUND_QTBUG_53071;
 		ptrdiff_t amax = nitems_max < (ptrdiff_t)SIZE_MAX ?
 		    nitems_max : (ptrdiff_t)SIZE_MAX;
+#endif
+		int nitems_max = IMAX - WORK_AROUND_QTBUG_53071;
+		int amax = nitems_max < IMAX ? nitems_max : IMAX;
 		if ((amax - 1) / 3 * 2 < *nitems_alloc)
 			memory_exhausted(_("integer overflow"));
 		*nitems_alloc += (*nitems_alloc >> 1) + 1;

Reply via email to