diff options
author | Albert Astals Cid <aacid@kde.org> | 2013-01-10 19:07:48 +0100 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2013-01-10 19:07:48 +0100 |
commit | bbc2d8918fe234b7ef2c480eb148943922cc0959 (patch) | |
tree | a0b994222a786236f3353bc4c7bfc4a441a7b0df | |
parent | a9b8ab4657dec65b8b86c225d12c533ad7e984e2 (diff) |
Fix invalid memory accesses in 1036.pdf.asan.23.17
-rw-r--r-- | splash/Splash.cc | 14 |
1 files 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 @@ | |||
14 | // Copyright (C) 2005-2013 Albert Astals Cid <aacid@kde.org> | 14 | // Copyright (C) 2005-2013 Albert Astals Cid <aacid@kde.org> |
15 | // Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> | 15 | // Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> |
16 | // Copyright (C) 2010-2012 Thomas Freitag <Thomas.Freitag@alfa.de> | 16 | // Copyright (C) 2010-2012 Thomas Freitag <Thomas.Freitag@alfa.de> |
17 | // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> | 17 | // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> |
18 | // Copyright (C) 2011, 2012 William Bader <williambader@hotmail.com> | 18 | // Copyright (C) 2011, 2012 William Bader <williambader@hotmail.com> |
19 | // Copyright (C) 2012 Markus Trippelsdorf <markus@trippelsdorf.de> | 19 | // Copyright (C) 2012 Markus Trippelsdorf <markus@trippelsdorf.de> |
20 | // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> | 20 | // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> |
@@ -3308,6 +3308,12 @@ void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData, | |||
3308 | Guchar *destPtr0, *destPtr; | 3308 | Guchar *destPtr0, *destPtr; |
3309 | int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1; | 3309 | int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1; |
3310 | int i; | 3310 | int i; |
3311 | |||
3312 | destPtr0 = dest->data; | ||
3313 | if (destPtr0 == NULL) { | ||
3314 | error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXd"); | ||
3315 | return; | ||
3316 | } | ||
3311 | 3317 | ||
3312 | // Bresenham parameters for y scale | 3318 | // Bresenham parameters for y scale |
3313 | yp = scaledHeight / srcHeight; | 3319 | yp = scaledHeight / srcHeight; |
@@ -3323,7 +3329,6 @@ void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData, | |||
3323 | // init y scale Bresenham | 3329 | // init y scale Bresenham |
3324 | yt = 0; | 3330 | yt = 0; |
3325 | 3331 | ||
3326 | destPtr0 = dest->data; | ||
3327 | for (y = 0; y < srcHeight; ++y) { | 3332 | for (y = 0; y < srcHeight; ++y) { |
3328 | 3333 | ||
3329 | // y scale Bresenham | 3334 | // y scale Bresenham |
@@ -4862,6 +4867,11 @@ void Splash::vertFlipImage(SplashBitmap *img, int width, int height, | |||
4862 | Guchar *lineBuf; | 4867 | Guchar *lineBuf; |
4863 | Guchar *p0, *p1; | 4868 | Guchar *p0, *p1; |
4864 | int w; | 4869 | int w; |
4870 | |||
4871 | if (unlikely(img->data == NULL)) { | ||
4872 | error(errInternal, -1, "img->data is NULL in Splash::vertFlipImage"); | ||
4873 | return; | ||
4874 | } | ||
4865 | 4875 | ||
4866 | w = width * nComps; | 4876 | w = width * nComps; |
4867 | lineBuf = (Guchar *)gmalloc(w); | 4877 | lineBuf = (Guchar *)gmalloc(w); |