Content-Length: 263610 | pFad | https://github.com/postgrespro/postgres/commit/23ed2ba8121178474f8c51774c6c258cb165a562

4D Another portability fix for tzcode2016g update. · postgrespro/postgres@23ed2ba · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/postgrespro/postgres/commit/23ed2ba8121178474f8c51774c6c258cb165a562

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy