From 752944af9da05fa3502fa93da1b14e7eb7a87ee8 Mon Sep 17 00:00:00 2001 From: kre Date: Sat, 5 Nov 2016 22:21:48 +0000 Subject: [PATCH] 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. --- lib/libc/time/zic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/libc/time/zic.c b/lib/libc/time/zic.c index 7e2066c16be9..92c87d172327 100644 --- a/lib/libc/time/zic.c +++ b/lib/libc/time/zic.c @@ -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 #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, ptrdiff_t nitems, ptrdiff_t *nitems_alloc) 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;