aboutsummaryrefslogtreecommitdiff
path: root/src/debug/pe/testdata
diff options
context:
space:
mode:
authorPrashant Agrawal <prashant.a.vjti@gmail.com>2019-05-17 17:55:20 -0700
committerAlex Brainman <alex.brainman@gmail.com>2019-08-29 08:57:06 +0000
commit3b92f36d15c868e856be71c0fadfc7ff97039b96 (patch)
tree38e4d4d710a83ce506231707f578f0c96d5e6dbe /src/debug/pe/testdata
parent8e4399ff77e7967543fb9f383511b3f3f8470cda (diff)
downloadgo-3b92f36d15c868e856be71c0fadfc7ff97039b96.tar.xz
debug/pe: enable parsing of variable length optional header in PE file
The debug/pe package assumes there are always 16 entries in DataDirectory in OptionalHeader32/64 ref pe.go: ... NumberOfRvaAndSizes uint32 DataDirectory [16]DataDirectory } ... But that is not always the case, there could be less no of entries (PE signed linux kernel for example): $ sudo pev /boot/vmlinuz-4.15.0-47-generic .... Data-dictionary entries: 6 .... In such case, the parsing gives incorrect results. This changes aims to fix that by: 1. Determining type of optional header by looking at header magic instead of size 2. Parsing optional header in 2 steps: a. Fixed part b. Variable data directories part Testing: 1. Fixed existing test cases to reflect the change 2. Added new file (modified linux kernel image) which has smaller number of data directories Fixes #32126 Change-Id: Iee56ecc4369a0e75a4be805e7cb8555c7d81ae2f Reviewed-on: https://go-review.googlesource.com/c/go/+/177959 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Diffstat (limited to 'src/debug/pe/testdata')
-rw-r--r--src/debug/pe/testdata/vmlinuz-4.15.0-47-genericbin0 -> 474 bytes
1 files changed, 0 insertions, 0 deletions
diff --git a/src/debug/pe/testdata/vmlinuz-4.15.0-47-generic b/src/debug/pe/testdata/vmlinuz-4.15.0-47-generic
new file mode 100644
index 0000000000..d01cf61d05
--- /dev/null
+++ b/src/debug/pe/testdata/vmlinuz-4.15.0-47-generic
Binary files differ