summaryrefslogtreecommitdiff
path: root/src/cairo-scaled-font.c
diff options
context:
space:
mode:
authorBryce Harrington <bryce@bryceharrington.org>2018-06-12 16:04:03 -0700
committerBryce Harrington <bryce@bryceharrington.org>2018-06-15 22:15:19 -0700
commit61122127943dcaff41501e1b06df2a852c576e9b (patch)
tree046a0d20078db179d33ae862807234b2c8400a0e /src/cairo-scaled-font.c
parent9c7d5a49c6c7a983c6798daf7362775ef1711239 (diff)
downloadcairo-61122127943dcaff41501e1b06df2a852c576e9b.tar.gz
scaled-font: Fix glyph and cluster count checks (CID #983386)
num_glyphs and num_clusters are explicitly checked to be non-NULL at the beginning of this routine, and by this point in the code both have been deref'd multiple times, so checking them for NULL here again is superfluous. It looks like the intent here is to verify the glyphs and clusters arrays are non-NULL unless their counts are zero, so change the tests accordingly. Coverity ID: #983386 Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
Diffstat (limited to 'src/cairo-scaled-font.c')
-rw-r--r--src/cairo-scaled-font.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index f7a36c1df..8dff57d95 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -2052,7 +2052,7 @@ cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
status = _cairo_error (CAIRO_STATUS_NEGATIVE_COUNT);
goto DONE;
}
- if (num_glyphs && *glyphs == NULL) {
+ if (*num_glyphs != 0 && *glyphs == NULL) {
status = _cairo_error (CAIRO_STATUS_NULL_POINTER);
goto DONE;
}
@@ -2062,7 +2062,7 @@ cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
status = _cairo_error (CAIRO_STATUS_NEGATIVE_COUNT);
goto DONE;
}
- if (num_clusters && *clusters == NULL) {
+ if (*num_clusters != 0 && *clusters == NULL) {
status = _cairo_error (CAIRO_STATUS_NULL_POINTER);
goto DONE;
}