jdeng / goheif

go gettable decoder/converter for HEIF/HEIC based on libde265
179 stars 67 forks source link

Segmentation error #15

Open Chillaso opened 4 years ago

Chillaso commented 4 years ago

I've the following error:

`../testdata/camel.heic: heif: no EXIF found unexpected fault address 0x7f3c51b1e010 fatal error: fault [signal SIGSEGV: segmentation violation code=0x1 addr=0x7f3c51b1e010 pc=0x4cdf70]

goroutine 1 [running]: runtime.throw(0x569c6d, 0x5) /usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc00012b390 sp=0xc00012b360 pc=0x445172 runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:702 +0x3cc fp=0xc00012b3c0 sp=0xc00012b390 pc=0x4590dc image/jpeg.yCbCrToYCbCr(0xc000116100, 0x0, 0x0, 0xc00012b4c0, 0xc00012b9c0, 0xc00012b5c0) /usr/local/go/src/image/jpeg/writer.go:461 +0x140 fp=0xc00012b438 sp=0xc00012b3c0 pc=0x4cdf70 image/jpeg.(*encoder).writeSOS(0xc00014a000, 0x58d020, 0xc000116100) /usr/local/go/src/image/jpeg/writer.go:547 +0x383 fp=0xc00012bde8 sp=0xc00012b438 pc=0x4ce503 image/jpeg.Encode(0x58bf60, 0xc00000fa00, 0x58d020, 0xc000116100, 0x0, 0x58bf60, 0xc00000fa00) /usr/local/go/src/image/jpeg/writer.go:634 +0x299 fp=0xc00012be60 sp=0xc00012bde8 pc=0x4ceac9 main.main() /home/chillaso/proyectos/goheif/heic2jpg/main.go:93 +0x2fa fp=0xc00012bf88 sp=0xc00012be60 pc=0x4e054a runtime.main() /usr/local/go/src/runtime/proc.go:203 +0x1fa fp=0xc00012bfe0 sp=0xc00012bf88 pc=0x4477da runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00012bfe8 sp=0xc00012bfe0 pc=0x472071`

I'm using Ubuntu 20.04. GCC 9.3.0 and go 1.14 in a linux/amd64

mikegleasonjr commented 4 years ago

Check if using safe encoding fixes it, see #3

rajendraventurit commented 3 years ago

Check if using safe encoding fixes it, see #3 I have checked safe encoding changes are there but still its crashing in container

ls

apiserv bin boot camel.heic convertheictojpg dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var

./convertheictojpg camel.heic test.jpeg

unexpected fault address 0x7f51e0221010 fatal error: fault [signal SIGSEGV: segmentation violation code=0x1 addr=0x7f51e0221010 pc=0x4d4760]

goroutine 1 [running]: runtime.throw(0x562edc, 0x5) /usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc00012b3b0 sp=0xc00012b380 pc=0x448c32 runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:741 +0x268 fp=0xc00012b3e8 sp=0xc00012b3b0 pc=0x45d828 image/jpeg.yCbCrToYCbCr(0xc000150080, 0x0, 0x0, 0xc00012b4e8, 0xc00012b9e8, 0xc00012b5e8) /usr/local/go/src/image/jpeg/writer.go:461 +0x140 fp=0xc00012b460 sp=0xc00012b3e8 pc=0x4d4760 image/jpeg.(*encoder).writeSOS(0xc000162000, 0x588628, 0xc000150080) /usr/local/go/src/image/jpeg/writer.go:547 +0x3ba fp=0xc00012be08 sp=0xc00012b460 pc=0x4d4d3a image/jpeg.Encode(0x5878a8, 0xc000120978, 0x588628, 0xc000150080, 0x0, 0x5878a8, 0xc000120978) /usr/local/go/src/image/jpeg/writer.go:634 +0x2bb fp=0xc00012be80 sp=0xc00012be08 pc=0x4d537b main.main() /apiserv/convertheictojpg/main.go:93 +0x2a5 fp=0xc00012bf88 sp=0xc00012be80 pc=0x4e6ee5 runtime.main() /usr/local/go/src/runtime/proc.go:225 +0x256 fp=0xc00012bfe0 sp=0xc00012bf88 pc=0x44b476 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc00012bfe8 sp=0xc00012bfe0 pc=0x47aa01

exit

gucoi commented 3 years ago

do you fix it? now ?

mikegleasonjr commented 3 years ago

if you set the global variable SafeEncoding to true on startup, it should not segfault in containers.
@rajendraventurit confirmed it in the PR above.