-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Closed
Labels
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.8 linux/amd64
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/valentin/Documents/2017/03/21/goDLL"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build002149362=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
image.Decode(r2) where r2 is reading a PNG image that looks ok to me.
See attached source.
(texture1, r1 are there just to demonstrate the happy path).
See self-contained code at https://play.golang.org/p/gkXmcSjbwq
What did you expect to see?
At best, no error at all.
Otherwise, image.Decode should return an error with some nice message.
What did you see instead?
2017/03/28 13:58:41 Texture 1
2017/03/28 13:58:41 size = 737
2017/03/28 13:58:41 format = jpeg
2017/03/28 13:58:41 err = <nil>
2017/03/28 13:58:41
2017/03/28 13:58:41 Texture 2
2017/03/28 13:58:41 size = 1031
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4a9d68]
goroutine 1 [running]:
image/png.(*decoder).readImagePass(0xc42002d800, 0x7f75cf6f4088, 0xc420018230, 0x0, 0xc420018200, 0x0, 0x0, 0xc420092000, 0xc42002d878)
/usr/local/go/src/image/png/reader.go:615 +0x1028
image/png.(*decoder).decode(0xc42002d800, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/image/png/reader.go:365 +0x621
image/png.(*decoder).parseIDAT(0xc42002d800, 0x3c0, 0x4e6d5e, 0x4)
/usr/local/go/src/image/png/reader.go:827 +0x36
image/png.(*decoder).parseChunk(0xc42002d800, 0x0, 0x0)
/usr/local/go/src/image/png/reader.go:887 +0x45a
image/png.Decode(0x7f75cf6f4030, 0xc420014240, 0xc420014240, 0x7f75cf6f4030, 0xc420014240, 0x8)
/usr/local/go/src/image/png/reader.go:946 +0x161
image.Decode(0x54f140, 0xc420016510, 0x407, 0xc420070900, 0x407, 0x480, 0x0, 0x0)
/usr/local/go/src/image/format.go:84 +0xfc
main.main()
/home/valentin/Documents/2017/03/28/tecrash/read.go:27 +0x677
exit status 2