diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-09-17 10:16:48 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2017-12-19 15:16:19 -0500 |
commit | d50dbbaf278c3dd9558a097124147e353a98c32a (patch) | |
tree | d41c8499e319343d0b3a69a6b61f5c61205214a6 /src/cairo-misc.c | |
parent | 903b0de539844c144c63ea57c30e84a23360c290 (diff) | |
download | cairo-d50dbbaf278c3dd9558a097124147e353a98c32a.tar.gz |
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.
Diffstat (limited to 'src/cairo-misc.c')
-rw-r--r-- | src/cairo-misc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cairo-misc.c b/src/cairo-misc.c index 07ffa9ffb..4c516edce 100644 --- a/src/cairo-misc.c +++ b/src/cairo-misc.c @@ -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; |