summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2016-05-29 23:34:35 -0700
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2016-05-30 21:25:00 -0700
commit3eddbca2690381bbbaf14adadb2679eea702095f (patch)
tree5b94cad008ca5e45e98ae887848aa3c64ed925fc /src
parentdfa572ea522a3019e91f2de7854b252c629342f2 (diff)
bitmap: Bail out on invalid input to FontFileMakeDir instead of calling calloc for 0 bytes
Found by clang static analysis: Call to 'calloc' has an allocation size of 0 bytes Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> (cherry picked from commit ac559fad20bbae45332c758abb6a790c3fd341a2)
Diffstat (limited to 'src')
-rw-r--r--src/bitmap/bitscale.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c
index c9af4c0..13ed924 100644
--- a/src/bitmap/bitscale.c
+++ b/src/bitmap/bitscale.c
@@ -1479,6 +1479,10 @@ BitmapScaleBitmaps(FontPtr pf, /* scaled font */
lastRow = pfi->lastRow;
nchars = (lastRow - firstRow + 1) * (lastCol - firstCol + 1);
+ if (nchars <= 0) {
+ goto bail;
+ }
+
glyph = pf->glyph;
for (i = 0; i < nchars; i++)
{