[PATCH libXfont 2/4] bitmap: Bail out on invalid input to FontFileMakeDir instead of calling calloc for 0 bytes
Jeremy Huddleston Sequoia
jeremyhu at apple.com
Mon May 30 07:53:44 UTC 2016
Found by clang static analysis:
Call to 'calloc' has an allocation size of 0 bytes
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
---
src/bitmap/bitscale.c | 4 ++++
1 file changed, 4 insertions(+)
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++)
{
--
2.8.3
More information about the xorg-devel
mailing list