summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce Harrington <bryce@osg.samsung.com>2015-06-04 14:24:31 -0700
committerBryce Harrington <bryce@osg.samsung.com>2015-06-04 14:24:31 -0700
commitb9ada819953303e708a376779ff27f75ff6bc51c (patch)
treece6d5cd5f6c65677e194b145d1be4c3b9a76af44
parentf032133e6d5ad05157fc46609d8c63103028342c (diff)
cairo-script: Improve buffer length check
Quells the following warning: cairo-script-scanner.c: In function ‘_translate_string’: cairo-script-scanner.c:1623:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (buf_len <= 8 + 2*string->len) { ^
-rw-r--r--util/cairo-script/cairo-script-scanner.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cairo-script/cairo-script-scanner.c b/util/cairo-script/cairo-script-scanner.c
index 4254aa01e..84b45dff9 100644
--- a/util/cairo-script/cairo-script-scanner.c
+++ b/util/cairo-script/cairo-script-scanner.c
@@ -1620,7 +1620,8 @@ _translate_string (csi_t *ctx,
if (uncompress ((Bytef *) buf, &buf_len,
(Bytef *) string->string, string->len) == Z_OK)
{
- if (buf_len <= 8 + 2*string->len) {
+ assert(string->len > 0);
+ if (buf_len <= 8 + 2*((unsigned long)string->len)) {
method = NONE;
deflate = 0;
} else {