From 5f156291cdcccba300866e89ef35837093ba52f9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 28 Aug 2021 19:57:31 +1000 Subject: Fix error scaling thumbnails to zero dimensions Follow up to fix for T89868. --- source/blender/imbuf/intern/thumbs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 17b619d451c..f312ec65bb3 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -435,8 +435,9 @@ static ImBuf *thumb_create_ex(const char *file_path, scaledy = (float)tsize; scaledx = ((float)img->x / (float)img->y) * tsize; } - 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); /* save some time by only scaling byte buf */ if (img->rect_float) { -- cgit v1.2.3