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.

Change-Id: I24eba41a2cd17e0d69ed95ea4e40a8d8a2661d10
Reviewed-on: https://go-review.googlesource.com/c/158217
Reviewed-by: Cherry Zhang <cherryyz@google.com>
1 file changed