libgo patch committed: Don't loop endlessly if we can't parse notes

Message ID CAOyqgcXPvBi2bmUC8C3_o9NxPdvkuT2APeVfheb3G=QoWaZU-Q@mail.gmail.com
State New
Headers show
Series
  • libgo patch committed: Don't loop endlessly if we can't parse notes
Related show

Commit Message

Ian Lance Taylor Jan. 11, 2018, 7:59 p.m.
This libgo patch avoids an endless loop in a cgo test if we can parse
the notes.  Thanks to Richi for identifying the problem.  This may be
the cause of GCC PR 83794.  Bootstrapped and ran cgo tests on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 256474)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-1176dd2b53f2d2b826b599a126f3f9828283cec3
+fe8481db9f5b37eb9a0c329673789eaaf1335598
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/misc/cgo/test/buildid_linux.go
===================================================================
--- libgo/misc/cgo/test/buildid_linux.go	(revision 256366)
+++ libgo/misc/cgo/test/buildid_linux.go	(working copy)
@@ -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