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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: hash_create(nelem = 0) does invalid memory accesses
Date: 2016-09-27 23:30:19
Message-ID: 11967.1475019019@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> 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 sizing the hashtable quite aside
from this one.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-09-27 23:31:57 Re: LLVM Address Sanitizer (ASAN) and valgrind support
Previous Message Andres Freund 2016-09-27 23:27:59 Re: LLVM Address Sanitizer (ASAN) and valgrind support