]> Cypherpunks repositories - gostls13.git/commit
debug/elf: perform stricter section header table checks in NewFile
authorTobias Klauser <tklauser@distanz.ch>
Thu, 14 Feb 2019 22:42:24 +0000 (23:42 +0100)
committerTobias Klauser <tobias.klauser@gmail.com>
Fri, 1 Mar 2019 06:04:20 +0000 (06:04 +0000)
commit4832bf8bde9df6695f6f4e15a7885a1609bb579f
tree835891016de1635367398105bb9276fafb1111e2
parentd24c3124cab290f5f7e1c75be4c6cbe6dd05a85c
debug/elf: perform stricter section header table checks in NewFile

If an ELF file has no section header table (shoff = 0), shnum must be
zero as well according to elf(5).

So far, when only shnum was zero but shoff was non-zero (i.e. in an
invalid ELF file) shstrndx wasn't properly checked and could result in
an 'index out of range' later on.

Fixes #10996

Change-Id: Ic248d2d77099b0036458e2a844b086a5f463c844
Reviewed-on: https://go-review.googlesource.com/c/162857
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/debug/elf/file.go
src/debug/elf/file_test.go