Re: [HACKERS] hash_create(nelem = 0) does invalid memory accesses

2016-09-27 Thread Tom Lane
Andres Freund writes: > debugging a citus valgrind bleat I noticed that hash_create() accesses > the result of palloc(0) as an hash element: > Do we consider this an API usage error that we want to fix? I think Assert(nelem > 0) would be an appropriate response. There are probably issues in sizin

[HACKERS] hash_create(nelem = 0) does invalid memory accesses

2016-09-27 Thread Andres Freund
Hi, debugging a citus valgrind bleat I noticed that hash_create() accesses the result of palloc(0) as an hash element: HTAB * hash_create(const char *tabname, long nelem, HASHCTL *info, int flags) { ... if ((flags & HASH_SHARED_MEM) || nelem < hctl->nelem_alloc) {