aboutsummaryrefslogtreecommitdiff
path: root/src/debug/dwarf/testdata
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2016-01-08 16:25:29 -0500
committerRuss Cox <rsc@golang.org>2016-01-14 02:05:31 +0000
commit535741a69a1300d1fe2800778b99c8a1b75d7fdd (patch)
tree1e74f282d5c78c6a352576b6abe8087be9f51fc2 /src/debug/dwarf/testdata
parent5f23bc8903c9b7930398c154b884979a1a43946f (diff)
downloadgo-535741a69a1300d1fe2800778b99c8a1b75d7fdd.tar.xz
debug/dwarf: fix nil pointer dereference in cyclic type structures
Currently readType simultaneously constructs a type graph and resolves the sizes of the types. However, these two operations are fundamentally at odds: the order we parse a cyclic structure in may be different than the order we need to resolve type sizes in. As a result, it's possible that when readType attempts to resolve the size of a typedef, it may dereference a nil Type field of another typedef retrieved from the type cache that's only partially constructed. To fix this, we delay resolving typedef sizes until the end of the readType recursion, when the full type graph is constructed. Fixes #13039. Change-Id: I9889af37fb3be5437995030fdd61e45871319d07 Reviewed-on: https://go-review.googlesource.com/18459 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/debug/dwarf/testdata')
-rw-r--r--src/debug/dwarf/testdata/cycle.c7
-rw-r--r--src/debug/dwarf/testdata/cycle.elfbin0 -> 2624 bytes
2 files changed, 7 insertions, 0 deletions
diff --git a/src/debug/dwarf/testdata/cycle.c b/src/debug/dwarf/testdata/cycle.c
new file mode 100644
index 0000000000..a0b53dfe74
--- /dev/null
+++ b/src/debug/dwarf/testdata/cycle.c
@@ -0,0 +1,7 @@
+typedef struct aaa *AAA;
+typedef AAA BBB;
+struct aaa { BBB val; };
+
+AAA x(void) {
+ return (AAA)0;
+}
diff --git a/src/debug/dwarf/testdata/cycle.elf b/src/debug/dwarf/testdata/cycle.elf
new file mode 100644
index 0000000000..e0b66caa63
--- /dev/null
+++ b/src/debug/dwarf/testdata/cycle.elf
Binary files differ