Commit fe49d100 authored by Ian Lance Taylor's avatar Ian Lance Taylor

misc/cgo/test: avoid endless loop when we can't parse notes

Change-Id: I085870d978a3a560588711882c77060d136d867a
Reviewed-on: https://go-review.googlesource.com/87415
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 1c0d5427
...@@ -27,6 +27,7 @@ func testBuildID(t *testing.T) { ...@@ -27,6 +27,7 @@ func testBuildID(t *testing.T) {
defer f.Close() defer f.Close()
c := 0 c := 0
sections:
for i, s := range f.Sections { for i, s := range f.Sections {
if s.Type != elf.SHT_NOTE { if s.Type != elf.SHT_NOTE {
continue continue
...@@ -47,7 +48,7 @@ func testBuildID(t *testing.T) { ...@@ -47,7 +48,7 @@ func testBuildID(t *testing.T) {
if len(d) < 12 { if len(d) < 12 {
t.Logf("note section %d too short (%d < 12)", i, len(d)) t.Logf("note section %d too short (%d < 12)", i, len(d))
continue continue sections
} }
namesz := f.ByteOrder.Uint32(d) namesz := f.ByteOrder.Uint32(d)
...@@ -59,7 +60,7 @@ func testBuildID(t *testing.T) { ...@@ -59,7 +60,7 @@ func testBuildID(t *testing.T) {
if int(12+an+ad) > len(d) { if int(12+an+ad) > len(d) {
t.Logf("note section %d too short for header (%d < 12 + align(%d,4) + align(%d,4))", i, len(d), namesz, descsz) t.Logf("note section %d too short for header (%d < 12 + align(%d,4) + align(%d,4))", i, len(d), namesz, descsz)
continue continue sections
} }
// 3 == NT_GNU_BUILD_ID // 3 == NT_GNU_BUILD_ID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment