From 5e711690bf724fdb02ca9b33f08e570e225d0e2a Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 3 Feb 2017 15:35:44 -0300 Subject: [PATCH] Fix crash with certain reference layers --- src/render/render.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/render/render.cpp b/src/render/render.cpp index 03c3b9fb1..57ea30901 100644 --- a/src/render/render.cpp +++ b/src/render/render.cpp @@ -1,5 +1,5 @@ // Aseprite Render Library -// Copyright (c) 2001-2016 David Capello +// Copyright (c) 2001-2017 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -426,6 +426,10 @@ void composite_image_general( double srcX = srcXStart; int oldSrcX; + // Out of bounds + if (srcY >= src->height()) + break; + ASSERT(srcY >= 0 && srcY < src->height()); auto dstPtr = get_pixel_address_fast(dst, dstBounds.x, dstY); @@ -444,9 +448,9 @@ void composite_image_general( oldSrcX = int(srcX); srcX = srcXStart + srcXDelta*x; - if (srcX >= srcWidth) { + // Out of bounds + if (srcX >= srcWidth) break; - } srcPtr += int(srcX - oldSrcX); #if _DEBUG