From: Ken Thompson Date: Wed, 10 Dec 2008 21:28:46 +0000 (-0800) Subject: string hash function faults w empty string X-Git-Tag: weekly.2009-11-06~2539 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e956429166632c68785a17be44b649ae6205bfb0;p=gostls13.git string hash function faults w empty string fixes maps[""] R=r OCL=20909 CL=20911 --- diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 3d0ee7f1e6..c075181a02 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -583,6 +583,8 @@ static uint64 stringhash(uint32 s, string *a) { USED(s); + if(*a == nil) + return memhash(emptystring->len, emptystring->str); return memhash((*a)->len, (*a)->str); }