Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Yurkovich <deadpin>2021-07-18 03:42:52 +0300
committerJeroen Bakker <jeroen@blender.org>2021-07-26 08:54:11 +0300
commitd097d35be6df2f109839dde4bbc35a31f69faf89 (patch)
tree9500f7c73feb81b3b91634fa967c53fbdf8530a7 /source/blender/editors/render/render_preview.c
parent9e64fd461ac3fa05e4ae780ee3a9f41b18c7c216 (diff)
Fix T89868: Crash showing thumbnail of wide-aspect image
Scaling down images could create images with a width or height of zero. Clamp at 1 to prevent a crash, also add an assert to scaling functions. Ref D11956
Diffstat (limited to 'source/blender/editors/render/render_preview.c')
-rw-r--r--source/blender/editors/render/render_preview.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 10e0a143d9b..23b3886ec46 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -1254,8 +1254,9 @@ static void icon_copy_rect(ImBuf *ibuf, uint w, uint h, uint *rect)
scaledy = (float)h;
}
- ex = (short)scaledx;
- ey = (short)scaledy;
+ /* Scaling down must never assign zero width/height, see: T89868. */
+ ex = MAX2(1, (short)scaledx);
+ ey = MAX2(1, (short)scaledy);
dx = (w - ex) / 2;
dy = (h - ey) / 2;