From: Ian Lance Taylor Date: Thu, 11 Jan 2018 17:53:56 +0000 (-0800) Subject: misc/cgo/test: avoid endless loop when we can't parse notes X-Git-Tag: go1.10rc1~47 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fe49d100e465501557c58448c3eb4c7b9a92d0b3;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/misc/cgo/test/buildid_linux.go b/misc/cgo/test/buildid_linux.go index 47dd87128f..84d3edb664 100644 --- a/misc/cgo/test/buildid_linux.go +++ b/misc/cgo/test/buildid_linux.go @@ -27,6 +27,7 @@ func testBuildID(t *testing.T) { defer f.Close() c := 0 +sections: for i, s := range f.Sections { if s.Type != elf.SHT_NOTE { continue @@ -47,7 +48,7 @@ func testBuildID(t *testing.T) { if len(d) < 12 { t.Logf("note section %d too short (%d < 12)", i, len(d)) - continue + continue sections } namesz := f.ByteOrder.Uint32(d) @@ -59,7 +60,7 @@ func testBuildID(t *testing.T) { 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) - continue + continue sections } // 3 == NT_GNU_BUILD_ID