From bbc2d8918fe234b7ef2c480eb148943922cc0959 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 10 Jan 2013 19:07:48 +0100 Subject: Fix invalid memory accesses in 1036.pdf.asan.23.17 --- splash/Splash.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/splash/Splash.cc b/splash/Splash.cc index 24d934ab..1f838afb 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -14,7 +14,7 @@ // Copyright (C) 2005-2013 Albert Astals Cid // Copyright (C) 2005 Marco Pesenti Gritti // Copyright (C) 2010-2012 Thomas Freitag -// Copyright (C) 2010 Christian Feuersänger +// Copyright (C) 2010 Christian Feuersänger // Copyright (C) 2011, 2012 William Bader // Copyright (C) 2012 Markus Trippelsdorf // Copyright (C) 2012 Adrian Johnson @@ -3308,6 +3308,12 @@ void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData, Guchar *destPtr0, *destPtr; int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1; int i; + + destPtr0 = dest->data; + if (destPtr0 == NULL) { + error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXd"); + return; + } // Bresenham parameters for y scale yp = scaledHeight / srcHeight; @@ -3323,7 +3329,6 @@ void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData, // init y scale Bresenham yt = 0; - destPtr0 = dest->data; for (y = 0; y < srcHeight; ++y) { // y scale Bresenham @@ -4862,6 +4867,11 @@ void Splash::vertFlipImage(SplashBitmap *img, int width, int height, Guchar *lineBuf; Guchar *p0, *p1; int w; + + if (unlikely(img->data == NULL)) { + error(errInternal, -1, "img->data is NULL in Splash::vertFlipImage"); + return; + } w = width * nComps; lineBuf = (Guchar *)gmalloc(w); -- cgit v1.2.3