File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -173,18 +173,16 @@ NC_hashmapnew(size_t startsize)
173173 hm = (NC_hashmap * )malloc (sizeof (NC_hashmap ));
174174
175175 if (startsize == 0 || startsize < MINTABLESIZE )
176- startsize = MINTABLESIZE ;
176+ startsize = MINTABLESIZE ;
177177 else {
178- startsize *= 4 ;
179- startsize /= 3 ;
180- startsize = findPrimeGreaterThan (startsize );
181- if (startsize == 0 ) {nullfree (hm ); return 0 ;}
178+ if (startsize > MAX_SIZE / 4 ){nullfree (hm );return 0 ;}
179+ startsize *= 4 ;
180+ startsize /= 3 ;
181+ startsize = findPrimeGreaterThan (startsize );
182+ if (startsize == 0 ) {nullfree (hm ); return 0 ;}
182183 }
183184 hm -> table = (NC_hentry * )calloc (sizeof (NC_hentry ), (size_t )startsize );
184- if (hm -> table == NULL ) {
185- nullfree (hm );
186- return 0 ;
187- }
185+ if (hm -> table == NULL ) {nullfree (hm );return 0 ;}
188186 hm -> alloc = startsize ;
189187 hm -> active = 0 ;
190188 return hm ;
You can’t perform that action at this time.
0 commit comments