Fix error scaling thumbnails to zero dimensions

Follow up to fix for T89868.
This commit is contained in:
Campbell Barton 2021-08-28 19:57:31 +10:00 • committed by Jeroen Bakker
parent d6facd44b5
commit 16637e7ff4

View file

@ -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) {