summaryrefslogtreecommitdiff
path: root/draw/draw_mesh.c
diff options
context:
space:
mode:
authorRobin Watts <robin@peeves.(none)>2012-06-11 11:49:31 -0700
committerRobin Watts <robin.watts@artifex.com>2012-06-11 19:55:54 +0100
commit4fddb35e247a2d81b9b78ca3543b97da9e9fce45 (patch)
treefe87bc8ab4351a8cb5a9892c83ab63837bb109b5 /draw/draw_mesh.c
parent120dabdf30be66b5d17f4c59862907bb5d176e27 (diff)
downloadmupdf-4fddb35e247a2d81b9b78ca3543b97da9e9fce45.tar.xz
Fix Bug 693102: Overflows in large pixmap indexing.
When we allocate a pixmap > 2G, but < 4G, the index into that pixmap, when calculated as an int can be negative. Fix this with various casts to unsigned int. If we ever move to support >4G images we'll need to rejig the casting to cast each part of the element to ptrdiff_t first.
Diffstat (limited to 'draw/draw_mesh.c')
-rw-r--r--draw/draw_mesh.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/draw/draw_mesh.c b/draw/draw_mesh.c
index 025ec366..924bd34d 100644
--- a/draw/draw_mesh.c
+++ b/draw/draw_mesh.c
@@ -269,7 +269,7 @@ static int clip_poly(float src[MAXV][MAXN],
static void paint_scan(fz_pixmap *pix, int y, int x1, int x2, int *v1, int *v2, int n)
{
- unsigned char *p = pix->samples + ((y - pix->y) * pix->w + (x1 - pix->x)) * pix->n;
+ unsigned char *p = pix->samples + (unsigned int)(((y - pix->y) * pix->w + (x1 - pix->x)) * pix->n);
int v[FZ_MAX_COLORS];
int dv[FZ_MAX_COLORS];
int w = x2 - x1;