Hi, I was working on making sure that allocations for [1] don't overflow size_t for large hash tables, when created on 32bit systems. I started to write code like
if (sizeof(SH_CONTAINS) * (uint64) tb->size) != sizeof(SH_CONTAINS) * (size_t) tb->size)) { elog(ERROR, "hash table too large for a 32 bit system"); } that could code potentially, although somewhat unlikely, be trigger on a 32bit system. That made me wonder if it's not actually a mistake for MemoryContextAllocExtended() size parameter to be declared Size/size_t. That prevents it from detecting such overflows, forcing code like the above on callsites. Comments? - Andres [1] http://archives.postgresql.org/message-id/20160727004333.r3e2k2y6fvk2ntup%40alap3.anarazel.de -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers