public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Stop archive iterator on error
@ 2019-01-21 22:58 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2019-01-21 22:58 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

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

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 863 bytes --]

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_;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-21 22:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 22:58 Go patch committed: Stop archive iterator on error Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).