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

image/jpeg: writer crashes with invalid memory address #15014

deepch opened this issue Mar 29, 2016 · 4 comments

image/jpeg: writer crashes with invalid memory address #15014

deepch opened this issue Mar 29, 2016 · 4 comments


Copy link

deepch commented Mar 29, 2016

go version go1.6 linux/amd64

fatal error: fault
[signal 0xb code=0x1 addr=0x18239c3 pc=0x56298b]

goroutine 58010 [running]:
runtime.throw(0x9102a0, 0x5)
/usr/local/go/src/runtime/panic.go:530 +0x90 fp=0xc857d64a08 sp=0xc857d649f0
/usr/local/go/src/runtime/sigpanic_unix.go:27 +0x2ab fp=0xc857d64a58 sp=0xc857d64a08
image.(_YCbCr).YCbCrAt(0xc8e2062480, 0x153, 0xf8, 0x263900000000)
/usr/local/go/src/image/ycbcr.go:81 +0x10b fp=0xc857d64ab8 sp=0xc857d64a58
image.(_YCbCr).At(0xc8e2062480, 0x153, 0xf8, 0x0, 0x0)
/usr/local/go/src/image/ycbcr.go:71 +0x45 fp=0xc857d64b00 sp=0xc857d64ab8
image/jpeg.toYCbCr(0x7f2cd0427438, 0xc8e2062480, 0x150, 0xf8, 0xc857d64c60, 0xc857d65360, 0xc857d64f60)
/usr/local/go/src/image/jpeg/writer.go:396 +0xe3 fp=0xc857d64b80 sp=0xc857d64b00
image/jpeg.(*encoder).writeSOS(0xc8200e8900, 0x7f2cd0427438, 0xc8e2062480)
/usr/local/go/src/image/jpeg/writer.go:522 +0x634 fp=0xc857d65598 sp=0xc857d64b80
image/jpeg.Encode(0x7f2cd03e5088, 0xc905042a10, 0x7f2cd0427438, 0xc8e2062480, 0x0, 0x0, 0x0)
/usr/local/go/src/image/jpeg/writer.go:607 +0x483 fp=0xc857d65728 sp=0xc857d65598
main.http_stream_jpeg(0x7f2cda313c70, 0xc820826270, 0xc8dd486380)
/home/deepweb/source-directory/module_http_api.go:131 +0x54c fp=0xc857d65a38 sp=0xc857d65728f


if err := jpeg.Encode(buffer, img, nil); err != nil {
log.Println("unable to encode image.")

@ianlancetaylor ianlancetaylor changed the title image/jpeg fault image/jpeg: writer crashes with invalid memory address Mar 29, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Mar 29, 2016
Copy link

Can you give us a way to recreate the problem ourselves?

Does your program use cgo or the unsafe package?

Copy link

deepch commented Mar 29, 2016

I will try to recreate the problem. And send you . The daemon is difficult for me to catch her ​​.
Yes my program uses unsafe.

But I think even get nil it should not fall.

Copy link

The program is not getting nil. It is getting a completely invalid address, which should be impossible in ordinary Go code. If you are using the unsafe package, please look very closely at the unsafe code.

Copy link

I'm going to close this until there's something we can do. Feel free to reopen if you have a stand-alone repro, ideally without unsafe.

@golang golang locked and limited conversation to collaborators Mar 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

4 participants