summaryrefslogtreecommitdiff
path: root/draw
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2011-02-03 10:38:01 +0000
committerTor Andersson <tor@ghostscript.com>2011-02-03 10:38:01 +0000
commit8355256a0fa6eedaa02a4e7b8ba3c2dbd58fe567 (patch)
tree5b3ffc94c327ff1a2eafbff99240644f621d29aa /draw
parentb9d32b1d76e298db1eaa7f42bf14c67496a5804d (diff)
downloadmupdf-8355256a0fa6eedaa02a4e7b8ba3c2dbd58fe567.tar.xz
Various patches from SumatraPDF.
Diffstat (limited to 'draw')
-rw-r--r--draw/imagescale.c2
-rw-r--r--draw/imagesmooth.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/draw/imagescale.c b/draw/imagescale.c
index 60edadb5..d40898b1 100644
--- a/draw/imagescale.c
+++ b/draw/imagescale.c
@@ -238,7 +238,7 @@ fz_scalepixmap(fz_pixmap *src, int xdenom, int ydenom)
oh = (src->h + ydenom - 1) / ydenom;
n = src->n;
- buf = fz_malloc(ow * n * ydenom);
+ buf = fz_calloc(ydenom, ow * n);
dst = fz_newpixmap(src->colorspace, 0, 0, ow, oh);
diff --git a/draw/imagesmooth.c b/draw/imagesmooth.c
index c1002f46..67b5f481 100644
--- a/draw/imagesmooth.c
+++ b/draw/imagesmooth.c
@@ -1108,6 +1108,8 @@ fz_smoothscalepixmap(fz_pixmap *src, float x, float y, float w, float h)
temp_span = contrib_cols->count * src->n;
temp_rows = contrib_rows->max_len;
+ if (temp_span <= 0 || temp_rows > INT_MAX / temp_span)
+ goto cleanup;
temp = fz_calloc(temp_span*temp_rows, sizeof(int));
if (temp == NULL)
goto cleanup;