diff --git a/convert/screen/screen.go b/convert/screen/screen.go index ae2ee98..269ab91 100644 --- a/convert/screen/screen.go +++ b/convert/screen/screen.go @@ -1,6 +1,7 @@ package screen import ( + "errors" "image" "image/color" @@ -369,6 +370,9 @@ func ScrToImg(scrPath string, mode uint8, p color.Palette) (*image.NRGBA, error) if err != nil { return nil, err } + if len(d) < (m.Width * m.Height) { + return nil, errors.New("bad format") + } switch mode { case 0: out = setImageMode0(out, p, d, m.Width, m.Height)