Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when passing a specific gif #4

Open
aymericbeaumet opened this issue Apr 9, 2024 · 2 comments
Open

Panic when passing a specific gif #4

aymericbeaumet opened this issue Apr 9, 2024 · 2 comments

Comments

@aymericbeaumet
Copy link

I've been playing with the latest version of go-thumbhash. I've found one specific image that makes the library panic. This image is a gif, we can't reproduce this consistenly as this library was able to process other gifs. Does this library supports gifs? It is unclear from the readme which image types are supported.

Minimal repro

$ go run . ~/Downloads/blob.gif
panic: runtime error: index out of range [889171] with length 889168

goroutine 1 [running]:
github.com/galdor/go-thumbhash.EncodeImage({0x10463d5f8, 0x1400007e240})
        /Users/aymericbeaumet/go/pkg/mod/github.com/galdor/[email protected]/thumbhash.go:36 +0x61c
main.main()
        /Users/aymericbeaumet/Workspace/aymericbeaumet/thumbhash-panic/main.go:25 +0x68
exit status 2
package main

import (
	"image"
	_ "image/gif"  // add gif support
	_ "image/jpeg" // add jpeg support
	_ "image/png"  // add png support
	"os"

	"github.com/galdor/go-thumbhash"
)

func main() {
	reader, err := os.Open(os.Args[1])
	if err != nil {
		panic(err)
	}

	var img image.Image
	img, _, err = image.Decode(reader)
	if err != nil {
		panic(err)
	}

	_ = thumbhash.EncodeImage(img) // panics
}
@aymericbeaumet aymericbeaumet changed the title Panic when passing a specific gif to thumbhash Panic when passing a specific gif Apr 9, 2024
@galdor
Copy link
Owner

galdor commented Apr 9, 2024

Can you reproduce that with master?

@aymericbeaumet
Copy link
Author

aymericbeaumet commented Apr 10, 2024

Using the latest master fixed the issue (command below) thank you! Would you recommend using master instead of v1.0.0, if so would this justify bumping a minor version?

go get github.com/galdor/go-thumbhash@5f40e920ff450b03da9e7a9875a452806fa89fe0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants