Skip to content

Commit

Permalink
add: add check bad format when opening bad size file
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelesaux committed May 1, 2024
1 parent 788d9c7 commit e7785ed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions convert/screen/screen.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package screen

import (
"errors"
"image"
"image/color"

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e7785ed

Please sign in to comment.