From f3a372e78e9039a1b393a367cd63fa38f0cbdc55 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 30 Sep 2025 08:24:50 -0300 Subject: [PATCH] Fix div by zero crash dropping image (fix #5447) --- src/app/util/conversion_to_image.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/util/conversion_to_image.cpp b/src/app/util/conversion_to_image.cpp index 4a613a973..91559b809 100644 --- a/src/app/util/conversion_to_image.cpp +++ b/src/app/util/conversion_to_image.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (c) 2024 Igara Studio S.A. +// Copyright (c) 2024-2025 Igara Studio S.A. // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -26,7 +26,7 @@ uint32_t convert_color_to_image(gfx::Color c, const os::SurfaceFormatData* fd) uint8_t b = ((c & fd->blueMask) >> fd->blueShift); uint8_t a = ((c & fd->alphaMask) >> fd->alphaShift); - if (fd->pixelAlpha == os::PixelAlpha::kPremultiplied) { + if (a > 0 && fd->pixelAlpha == os::PixelAlpha::kPremultiplied) { r = r * 255 / a; g = g * 255 / a; b = b * 255 / a;