diff options
author | Albert Astals Cid <aacid@kde.org> | 2013-01-09 22:47:28 +0100 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2013-01-09 22:47:28 +0100 |
commit | a205e71a2dbe0c8d4f4905a76a3f79ec522eacec (patch) | |
tree | 3d59175572ca50732cbf6aaedcdb19ad2d6339b9 | |
parent | b1026b5978c385328f2a15a2185c599a563edf91 (diff) |
Do not crash in broken documents like 1007.pdf.asan.48.4
-rw-r--r-- | splash/Splash.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/splash/Splash.cc b/splash/Splash.cc index 336872b2..2e3687ad 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc | |||
@@ -2954,6 +2954,11 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData, | |||
2954 | // scale the input image | 2954 | // scale the input image |
2955 | scaledMask = scaleMask(src, srcData, srcWidth, srcHeight, | 2955 | scaledMask = scaleMask(src, srcData, srcWidth, srcHeight, |
2956 | scaledWidth, scaledHeight); | 2956 | scaledWidth, scaledHeight); |
2957 | if (scaledMask->data == NULL) { | ||
2958 | error(errInternal, -1, "scaledMask->data is NULL in Splash::scaleMaskYuXu"); | ||
2959 | delete scaledMask; | ||
2960 | return; | ||
2961 | } | ||
2957 | 2962 | ||
2958 | // construct the three sections | 2963 | // construct the three sections |
2959 | i = (vy[2] <= vy[3]) ? 2 : 3; | 2964 | i = (vy[2] <= vy[3]) ? 2 : 3; |
@@ -3381,6 +3386,12 @@ void Splash::scaleMaskYuXu(SplashImageMaskSource src, void *srcData, | |||
3381 | int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx; | 3386 | int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx; |
3382 | int i, j; | 3387 | int i, j; |
3383 | 3388 | ||
3389 | destPtr0 = dest->data; | ||
3390 | if (destPtr0 == NULL) { | ||
3391 | error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXu"); | ||
3392 | return; | ||
3393 | } | ||
3394 | |||
3384 | // Bresenham parameters for y scale | 3395 | // Bresenham parameters for y scale |
3385 | yp = scaledHeight / srcHeight; | 3396 | yp = scaledHeight / srcHeight; |
3386 | yq = scaledHeight % srcHeight; | 3397 | yq = scaledHeight % srcHeight; |
@@ -3395,7 +3406,6 @@ void Splash::scaleMaskYuXu(SplashImageMaskSource src, void *srcData, | |||
3395 | // init y scale Bresenham | 3406 | // init y scale Bresenham |
3396 | yt = 0; | 3407 | yt = 0; |
3397 | 3408 | ||
3398 | destPtr0 = dest->data; | ||
3399 | for (y = 0; y < srcHeight; ++y) { | 3409 | for (y = 0; y < srcHeight; ++y) { |
3400 | 3410 | ||
3401 | // y scale Bresenham | 3411 | // y scale Bresenham |