diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2015-07-28 20:50:00 +0200 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-07-28 20:11:19 +0000 |
| commit | 0c22a74e8594ee88c54a7716e710e788bd960bd2 (patch) | |
| tree | 28009da63a1eba8d0c32f4ded20493f6709ce60b /src/runtime/stack1.go | |
| parent | 7a63ab1a653d957bcf4e690ea70d6838382015e0 (diff) | |
| download | go-0c22a74e8594ee88c54a7716e710e788bd960bd2.tar.xz | |
runtime: fix out-of-bounds in stack debugging
Currently stackDebug=4 crashes as:
panic: runtime error: index out of range
fatal error: panic on system stack
runtime stack:
runtime.throw(0x607470, 0x15)
src/runtime/panic.go:527 +0x96
runtime.gopanic(0x5ada00, 0xc82000a1d0)
src/runtime/panic.go:354 +0xb9
runtime.panicindex()
src/runtime/panic.go:12 +0x49
runtime.adjustpointers(0xc820065ac8, 0x7ffe58b56100, 0x7ffe58b56318, 0x0)
src/runtime/stack1.go:428 +0x5fb
runtime.adjustframe(0x7ffe58b56200, 0x7ffe58b56318, 0x1)
src/runtime/stack1.go:542 +0x780
runtime.gentraceback(0x487760, 0xc820065ac0, 0x0, 0xc820001080, 0x0, 0x0, 0x7fffffff, 0x6341b8, 0x7ffe58b56318, 0x0, ...)
src/runtime/traceback.go:336 +0xa7e
runtime.copystack(0xc820001080, 0x1000)
src/runtime/stack1.go:616 +0x3b1
runtime.newstack()
src/runtime/stack1.go:801 +0xdde
Change-Id: If2d60960231480a9dbe545d87385fe650d6db808
Reviewed-on: https://go-review.googlesource.com/12763
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/stack1.go')
| -rw-r--r-- | src/runtime/stack1.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/stack1.go b/src/runtime/stack1.go index 113334b0d6..efcb5f25fa 100644 --- a/src/runtime/stack1.go +++ b/src/runtime/stack1.go @@ -425,7 +425,7 @@ func adjustpointers(scanp unsafe.Pointer, cbv *bitvector, adjinfo *adjustinfo, f num := uintptr(bv.n) for i := uintptr(0); i < num; i++ { if stackDebug >= 4 { - print(" ", add(scanp, i*ptrSize), ":", ptrnames[ptrbit(&bv, i)], ":", hex(*(*uintptr)(add(scanp, i*ptrSize))), " # ", i, " ", bv.bytedata[i/4], "\n") + print(" ", add(scanp, i*ptrSize), ":", ptrnames[ptrbit(&bv, i)], ":", hex(*(*uintptr)(add(scanp, i*ptrSize))), " # ", i, " ", bv.bytedata[i/8], "\n") } if ptrbit(&bv, i) == 1 { pp := (*uintptr)(add(scanp, i*ptrSize)) |
