diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2016-05-29 23:34:35 -0700 |
---|---|---|
committer | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2016-05-29 23:35:10 -0700 |
commit | ac559fad20bbae45332c758abb6a790c3fd341a2 (patch) | |
tree | b93771754a3d6b82efc9a727ca7a71391f4e0520 | |
parent | d0fff111992fed9d9bfbf0c19e136bda9ba1db55 (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>
-rw-r--r-- | src/bitmap/bitscale.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c index 22747a9..00adcc6 100644 --- a/src/bitmap/bitscale.c +++ b/src/bitmap/bitscale.c @@ -1477,6 +1477,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++) { |