diff mbox series

Go patch committed: Stop archive iterator on error

Message ID CAOyqgcUHa_HMhXdhs0DPYW-_tqTvQf9gAJjEFJM7y+RQgOoXow@mail.gmail.com
State New
Headers show
Series Go patch committed: Stop archive iterator on error | expand

Commit Message

Ian Lance Taylor Jan. 21, 2019, 10:58 p.m. UTC
In the Go frontend, if there is an error reading or parsing an archive
header, the Archive_iterator code would return a dummy header but
would not mark itself as done.  The effect is that an invalid archive
leads to an endless loop reading and re-reading the same archive
header.  Avoid that by setting the offset to the end of the file,
which will cause the iterator to == archive_end.  No test since it
doesn't seem worth constructing an invalid archive.  Bootstrapped and
ran Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
diff mbox series

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 268084)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-c76ba3014e42cc6adc3d43709bba28c5ad7a6ba2
+e7427654f3af83e1feea727a62a97172d7721403
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/import-archive.cc
===================================================================
--- gcc/go/gofrontend/import-archive.cc	(revision 268078)
+++ gcc/go/gofrontend/import-archive.cc	(working copy)
@@ -780,6 +780,7 @@  Archive_iterator::read_next_header()
                                      &this->next_off_))
 	{
 	  this->header_.off = filesize;
+	  this->off_ = filesize;
 	  return;
 	}
       this->header_.off = this->off_;