[sr-dev] RLS module default hash size

Andrew Mortensen admorten at isc.upenn.edu
Thu Jan 23 16:12:56 CET 2014


On Jan 23, 2014, at 5:45 AM, Richard Good <richard.good at smilecoms.com> wrote:

> Hi
> 
> I am re-using the pres shtable pattern from the RLS module.
> 
> I've found that the default size of the hash size is 512 when I think it should be 9 (2^9=512) (rls.c line 92 in master)
> 
> If you do not set the hash size from the config file the code will bit shift 512 and you will get an overflow.
> 
> Am I correct? 

Yes, you're correct. The result is undefined behavior, according to C99. Compiling with clang I get "warning: shift count >= width of type [-Wshift-count-overflow]", but the result of the shift is a large int that would presumably exhaust (or nearly exhaust) shared memory when calling new_shtable.

andrew


More information about the sr-dev mailing list