Skip to content

Commit 23ed2ba

Browse files
committed
Another portability fix for tzcode2016g update.
clang points out that SIZE_MAX wouldn't fit into an int, which means this comparison is pretty useless. Per report from Thomas Munro.
1 parent ad90ac4 commit 23ed2ba

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/timezone/zic.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,8 @@ growalloc(void *ptr, size_t itemsize, int nitems, int *nitems_alloc)
424424
else
425425
{
426426
int nitems_max = INT_MAX - WORK_AROUND_QTBUG_53071;
427-
int amax = nitems_max < SIZE_MAX ? nitems_max : SIZE_MAX;
428427

429-
if ((amax - 1) / 3 * 2 < *nitems_alloc)
428+
if ((nitems_max - 1) / 3 * 2 < *nitems_alloc)
430429
memory_exhausted(_("int overflow"));
431430
*nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1;
432431
return erealloc(ptr, size_product(*nitems_alloc, itemsize));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy