1
0
mirror of https://github.com/golang/go synced 2024-10-05 05:11:25 -06:00
go/src/cmd
Rhys Hiltner 3375974e0d cmd/link/internal/ld: don't panic on short buildid
When the linker was written in C, command line arguments were passed
around as null-terminated byte arrays which encouraged checking
characters one at a time. In Go, that can easily lead to
out-of-bounds panics.

Use the more idiomatic strings.HasPrefix when checking cmd/link's -B
argument to avoid the panic, and replace the manual hex decode with
use of the encoding/hex package.

Fixes #14636

Change-Id: I45f765bbd8cf796fee1a9a3496178bf76b117827
Reviewed-on: https://go-review.googlesource.com/20211
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-04 21:20:09 +00:00
..
addr2line cmd/addr2line: simplify windows test 2015-06-17 14:23:20 +00:00
api all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
asm all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
cgo all: single space after period. 2016-03-02 00:13:47 +00:00
compile cmd/compile: convert inl.go to use nodeSeq 2016-03-04 19:25:42 +00:00
cover all: single space after period. 2016-03-02 00:13:47 +00:00
dist all: single space after period. 2016-03-02 00:13:47 +00:00
doc all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
fix all: single space after period. 2016-03-02 00:13:47 +00:00
go cmd/go: set GOPATH in list's Context 2016-03-03 09:09:16 +00:00
gofmt all: single space after period. 2016-03-02 00:13:47 +00:00
internal cmd/internal/obj/ppc64: eliminate ~700 conversions by tweaking signatures 2016-03-04 06:30:25 +00:00
link cmd/link/internal/ld: don't panic on short buildid 2016-03-04 21:20:09 +00:00
newlink all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
nm all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
objdump cmd/objdump: skip TestDisasm* for mips64{,le} 2015-09-10 18:27:09 +00:00
pack all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
pprof all: single space after period. 2016-03-02 00:13:47 +00:00
trace all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
vet cmd/vet: Use function signature to find format string index. 2016-03-04 00:00:20 +00:00
yacc all: single space after period. 2016-03-02 00:13:47 +00:00