Created
September 8, 2014 01:55
-
-
Save bmatsuo/2cad6e15c1e3a04d9879 to your computer and use it in GitHub Desktop.
This gist demonstrates several panics in the snappy-go package resulting from passing the Decode function malformed input. The snappy-go rev is 12e4b4183793, current at the time these tests were run.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
panic: runtime error: index out of range | |
goroutine 16 [running]: | |
runtime.panic(0x4b9d80, 0x546cbc) | |
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5 | |
code.google.com/p/snappy-go/snappy.Decode(0x0, 0x0, 0x0, 0x7f713339ceb5, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, ...) | |
/home/bryan/src/code.google.com/p/snappy-go/snappy/decode.go:49 +0xb0c | |
main.main() | |
/home/bryan/src/github.com/bmatsuo/sandbox/snappy-go-panic/snappy-go-index/main.go:11 +0x9c | |
goroutine 17 [runnable]: | |
runtime.MHeap_Scavenger() | |
/usr/local/go/src/pkg/runtime/mheap.c:507 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
goroutine 18 [runnable]: | |
bgsweep() | |
/usr/local/go/src/pkg/runtime/mgc0.c:1976 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
goroutine 19 [runnable]: | |
runfinq() | |
/usr/local/go/src/pkg/runtime/mgc0.c:2606 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
exit status 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"code.google.com/p/snappy-go/snappy" | |
) | |
func main() { | |
encp := []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00} | |
decp, err := snappy.Decode(nil, encp) | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Printf("%q", decp) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
panic: runtime error: makeslice: len out of range | |
goroutine 16 [running]: | |
runtime.panic(0x4b9c80, 0x545320) | |
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5 | |
code.google.com/p/snappy-go/snappy.Decode(0x0, 0x0, 0x0, 0x7f8aaf3abeb1, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...) | |
/home/bryan/src/code.google.com/p/snappy-go/snappy/decode.go:44 +0x14b | |
main.main() | |
/home/bryan/src/github.com/bmatsuo/sandbox/snappy-go-panic/snappy-go-mkslice/main.go:11 +0x9c | |
goroutine 17 [runnable]: | |
runtime.MHeap_Scavenger() | |
/usr/local/go/src/pkg/runtime/mheap.c:507 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
goroutine 18 [runnable]: | |
bgsweep() | |
/usr/local/go/src/pkg/runtime/mgc0.c:1976 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
goroutine 19 [runnable]: | |
runfinq() | |
/usr/local/go/src/pkg/runtime/mgc0.c:2606 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
exit status 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"code.google.com/p/snappy-go/snappy" | |
) | |
func main() { | |
encp := []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00} | |
decp, err := snappy.Decode(nil, encp) | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Printf("%q", decp) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fatal error: runtime: out of memory | |
goroutine 16 [running]: | |
runtime.throw(0x545b57) | |
/usr/local/go/src/pkg/runtime/panic.c:520 +0x69 fp=0x7f0d6741cac0 sp=0x7f0d6741caa8 | |
runtime.SysMap(0xc208100000, 0x800000000, 0x0, 0x54dc18) | |
/usr/local/go/src/pkg/runtime/mem_linux.c:147 +0x93 fp=0x7f0d6741caf0 sp=0x7f0d6741cac0 | |
runtime.MHeap_SysAlloc(0x559c00, 0x800000000) | |
/usr/local/go/src/pkg/runtime/malloc.goc:616 +0x15b fp=0x7f0d6741cb48 sp=0x7f0d6741caf0 | |
MHeap_Grow(0x559c00, 0x400000) | |
/usr/local/go/src/pkg/runtime/mheap.c:319 +0x5d fp=0x7f0d6741cb88 sp=0x7f0d6741cb48 | |
MHeap_AllocLocked(0x559c00, 0x400000, 0x0) | |
/usr/local/go/src/pkg/runtime/mheap.c:222 +0x379 fp=0x7f0d6741cbc8 sp=0x7f0d6741cb88 | |
runtime.MHeap_Alloc(0x559c00, 0x400000, 0x10100000000) | |
/usr/local/go/src/pkg/runtime/mheap.c:178 +0x7b fp=0x7f0d6741cbf0 sp=0x7f0d6741cbc8 | |
largealloc(0x1, 0x7f0d6741cca0) | |
/usr/local/go/src/pkg/runtime/malloc.goc:224 +0xa2 fp=0x7f0d6741cc38 sp=0x7f0d6741cbf0 | |
runtime.mallocgc(0x7ffffffff, 0x498521, 0x1) | |
/usr/local/go/src/pkg/runtime/malloc.goc:169 +0xb6 fp=0x7f0d6741cca0 sp=0x7f0d6741cc38 | |
cnew(0x498520, 0x7ffffffff, 0x7f0d00000001) | |
/usr/local/go/src/pkg/runtime/malloc.goc:836 +0xc1 fp=0x7f0d6741ccc0 sp=0x7f0d6741cca0 | |
runtime.cnewarray(0x498520, 0x7ffffffff) | |
/usr/local/go/src/pkg/runtime/malloc.goc:849 +0x3a fp=0x7f0d6741cce0 sp=0x7f0d6741ccc0 | |
makeslice1(0x494f40, 0x7ffffffff, 0x7ffffffff, 0x7f0d6741cd40) | |
/usr/local/go/src/pkg/runtime/slice.goc:55 +0x4d fp=0x7f0d6741ccf8 sp=0x7f0d6741cce0 | |
runtime.makeslice(0x494f40, 0x7ffffffff, 0x7ffffffff, 0x0, 0x7ffffffff, 0x7ffffffff) | |
/usr/local/go/src/pkg/runtime/slice.goc:36 +0xb3 fp=0x7f0d6741cd28 sp=0x7f0d6741ccf8 | |
code.google.com/p/snappy-go/snappy.Decode(0x0, 0x0, 0x0, 0x7f0d6741ceb2, 0x6, 0x6, 0x0, 0x0, 0x0, 0x0, ...) | |
/home/bryan/src/code.google.com/p/snappy-go/snappy/decode.go:44 +0x14b fp=0x7f0d6741ce58 sp=0x7f0d6741cd28 | |
main.main() | |
/home/bryan/src/github.com/bmatsuo/sandbox/snappy-go-panic/snappy-go-oom/main.go:11 +0x9c fp=0x7f0d6741cf50 sp=0x7f0d6741ce58 | |
runtime.main() | |
/usr/local/go/src/pkg/runtime/proc.c:247 +0x11a fp=0x7f0d6741cfa8 sp=0x7f0d6741cf50 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 fp=0x7f0d6741cfb0 sp=0x7f0d6741cfa8 | |
created by _rt0_go | |
/usr/local/go/src/pkg/runtime/asm_amd64.s:97 +0x120 | |
goroutine 17 [runnable]: | |
runtime.MHeap_Scavenger() | |
/usr/local/go/src/pkg/runtime/mheap.c:507 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
goroutine 18 [runnable]: | |
bgsweep() | |
/usr/local/go/src/pkg/runtime/mgc0.c:1976 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
goroutine 19 [runnable]: | |
runfinq() | |
/usr/local/go/src/pkg/runtime/mgc0.c:2606 | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
exit status 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"code.google.com/p/snappy-go/snappy" | |
) | |
func main() { | |
encp := []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0x00} | |
decp, err := snappy.Decode(nil, encp) | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Printf("%q", decp) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment