nfnt / resize

Pure golang image resizing
ISC License
3.02k stars 321 forks source link

Runtime panic when trying to resize 4:1:1 YCbCr image #37

Closed carl-mastrangelo closed 6 years ago

carl-mastrangelo commented 9 years ago

I got a runtime panic when trying to resize a jpeg image that has 4x1 Chroma Subsampling, aka. image.YCbCrSubsampleRatio411. In ycc.go, it seems the default is 444 if no other sample is matched, which causes an index out of range panic.

I have a reproducible test program and image, if desired.

carl-mastrangelo commented 8 years ago

Friendly ping. This represents a DoS vector when the picture comes from an untrusted source. In my case it is creating a thumbnail from a user uploaded picture.

nfnt commented 6 years ago

Fixed by #57.