mattn / longcat

Looooooooooooooooooooooooooooooooooooooooooooooong cat
MIT License
666 stars 26 forks source link

Avoid crash with invalid integer flags #24

Closed yoichi closed 5 years ago

yoichi commented 5 years ago

Since flag.IntVar accepts negative value, it may cause crash on subsequent processing.

e.g. on mlterm negative-n-on-mlterm

mattn commented 5 years ago

Thanks. But this is a bug of go-sixel. I'll open this as issue until fixing go-sixel.

mattn commented 5 years ago

Fixed go-sixel.

yoichi commented 5 years ago

I've observed crushed image and ''png: invalid format: invalid image size: 0x0" with iTerm2, Pixmap and ASCII. Those should be fixed in backends (iterm/iterm.go, pixterm/pixterm.go, ascii/ascii.go)? crushed_cat

~/prog/longcat(master)$ ./longcat -ascii -n -3
       :d;';:cx,.
       do;';cl;lxk0'
.c:lc;.lc,;::ol   .
 ..'cxOd:;c:;c0;
     ..;c::;;;:.
       'x::cc::
       kkc;dkcl
      ,lcl;clco
~/prog/longcat(master)$ ./longcat -ascii -n -4
       ox  do
 . .  'ddxxoo:
~/prog/longcat(master)$ ./longcat -ascii -n -5
2019/10/09 06:15:05 png: invalid format: invalid image size: 0x0
mattn commented 5 years ago

Yes, will fix in new issue.