Closed
Description
Here is another issue I found with the help of go-fuzz:
I'm able to decode data but aren't able to encode it back.
package main
import (
"bytes"
"fmt"
"github.com/pixiv/go-libjpeg/jpeg"
)
func main() {
data := []byte("\xff\xd8\xff\xdb\x00C\x000000000000000" +
"00000000000000000000" +
"00000000000000000000" +
"00000000000\xff\xc0\x00\x11\b\x00000" +
"\x03R\"\x00G\x11\x00B\x11\x00\xff\xda\x00\f\x03R\x00G\x00B" +
"\x00")
img, err := jpeg.Decode(bytes.NewReader(data), &jpeg.DecoderOptions{})
if err != nil {
return
}
var w bytes.Buffer
err = jpeg.Encode(&w, img, &jpeg.EncoderOptions{})
if err != nil {
panic(err)
}
}
It prints
Invalid SOS parameters for sequential JPEG
panic: unsupported image type
I use go version go1.12.9 darwin/amd64, libjpeg-turbo 2.0.2
Metadata
Metadata
Assignees
Labels
No labels