]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/goobj: accept int64 in readInt
authorCherry Zhang <cherryyz@google.com>
Fri, 6 Oct 2017 19:00:02 +0000 (15:00 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 1 Nov 2017 18:23:58 +0000 (18:23 +0000)
commit7bd0b6100070d6a24458eded77228d37bfa1eb76
treef4b4235e4443e1e7cbe8aa06c54ce51c030c97d4
parent85c32c3744d879392c43a4ec4772199b28c9b34e
cmd/internal/goobj: accept int64 in readInt

The counter part, writeInt in cmd/internal/obj, writes int64s.
So the reader side should also read int64s. This may cause a
larger range of values being accepted, some of which should
not be that large. This is probably ok: for example, for
size/index/length, the very large value (due to corruption)
may be well past the end and causes other errors. And we did
not do much bound check anyway.

One exmaple where this matters is ARM32's object file. For one
type of relocation it encodes the instruction into Reloc.Add
field (which itself may be problematic and worth fix) and the
instruction encoding overflows int32, causing ARM32 object
file being rejected by goobj (and so objdump and nm) before.

Unskip ARM32 object file tests in goobj, nm, and objdump.

Updates #19811.

Change-Id: Ia46c2b68df5f1c5204d6509ceab6416ad6372315
Reviewed-on: https://go-review.googlesource.com/69010
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/internal/goobj/goobj_test.go
src/cmd/internal/goobj/read.go
src/cmd/nm/nm_cgo_test.go
src/cmd/objdump/objdump_test.go