From c4c9771b784cfc75c72279a7e30a0757eb2d104d Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 16 Jul 2020 02:59:50 +0900 Subject: [PATCH] mipmap: Bug fix: Infinite loop at (*Mipmap).mipmapLevelFromDistance --- internal/mipmap/mipmap.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/mipmap/mipmap.go b/internal/mipmap/mipmap.go index 1cccf6590..d8cb4554f 100644 --- a/internal/mipmap/mipmap.go +++ b/internal/mipmap/mipmap.go @@ -267,6 +267,9 @@ func (m *Mipmap) mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 d := (dx1-dx0)*(dx1-dx0) + (dy1-dy0)*(dy1-dy0) s := (sx1-sx0)*(sx1-sx0) + (sy1-sy0)*(sy1-sy0) + if s == 0 { + return 0 + } scale := d / s // Use 'negative' mipmap to render edges correctly (#611, #907).