From: ian Date: Mon, 21 Jan 2019 22:58:04 +0000 (+0000) Subject: compiler: stop iterator on error X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4123e263f10b16111bce494e16d87bf05e78b174;p=thirdparty%2Fgcc.git compiler: stop iterator on error 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. Reviewed-on: https://go-review.googlesource.com/c/158217 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268129 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 3c1d270cb5c9..c5b51b79a956 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/gcc/go/gofrontend/import-archive.cc b/gcc/go/gofrontend/import-archive.cc index a6d54037ce78..868def7cc757 100644 --- a/gcc/go/gofrontend/import-archive.cc +++ b/gcc/go/gofrontend/import-archive.cc @@ -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_;