mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-01 05:37:59 +02:00
Make _intern_string_hash safe for ""
The loop was unnecessarily written in a way that fails to terminate if len is 0 (ie for the empty string). Avoid that by checking for len > 0 explicitly.
This commit is contained in:
parent
903b0de539
commit
d50dbbaf27
1 changed files with 1 additions and 1 deletions
|
|
@ -986,7 +986,7 @@ _intern_string_hash (const char *str, int len)
|
|||
const signed char *p = (const signed char *) str;
|
||||
unsigned int h = *p;
|
||||
|
||||
for (p += 1; --len; p++)
|
||||
for (p += 1; len > 0; len--, p++)
|
||||
h = (h << 5) - h + *p;
|
||||
|
||||
return h;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue