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:
authorCampbell Barton <ideasman42@gmail.com>2021-08-28 12:57:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-08-28 14:33:06 +0300
commit079791dc30571227393db525704baea7540fb5c6 (patch)
tree9d10d9611f7f81d7528d7fc21bff099831863e5a
parent0b6be261261151032b6ebfe80320ff198b5df200 (diff)
Fix error scaling thumbnails to zero dimensions
Follow up to fix for T89868.
-rw-r--r--source/blender/imbuf/intern/thumbs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 19f34a6aacd..a09f06726a6 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) {