diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-28 12:57:31 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-09-06 10:34:19 +0300 |
commit | 16637e7ff40b4a18c4dc41c87c25079bf396be5f (patch) | |
tree | 79b73e4f69c6afac0d3905dcbb804820afcb9bd2 | |
parent | d6facd44b53108575381ca0637cd0fff73d45391 (diff) |
Fix error scaling thumbnails to zero dimensions
Follow up to fix for T89868.
-rw-r--r-- | source/blender/imbuf/intern/thumbs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 61bc185eb8d..60ad70aa8d8 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) { |