From: Robert Griesemer Date: Thu, 22 Oct 2015 17:08:45 +0000 (-0700) Subject: cmd/internal/goobj: permit 0 bytes in export data (prep. for new export format) X-Git-Tag: go1.6beta1~740 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4e777c8eff78149eca93b19f65994d71639059ef;p=gostls13.git cmd/internal/goobj: permit 0 bytes in export data (prep. for new export format) Change-Id: Ida9a82a5420a41ef656388866a1cf8fadf12ccc6 Reviewed-on: https://go-review.googlesource.com/16220 Reviewed-by: Chris Manghane --- diff --git a/src/cmd/internal/goobj/read.go b/src/cmd/internal/goobj/read.go index 1b0c9646bc..7fdaf557c8 100644 --- a/src/cmd/internal/goobj/read.go +++ b/src/cmd/internal/goobj/read.go @@ -564,7 +564,9 @@ func (r *objReader) parseObject(prefix []byte) error { var c1, c2, c3 byte for { c1, c2, c3 = c2, c3, r.readByte() - if c3 == 0 { // NUL or EOF, either is bad + // The new export format can contain 0 bytes. + // Don't consider them errors, only look for r.err != nil. + if r.err != nil { return errCorruptObject } if c1 == '\n' && c2 == '!' && c3 == '\n' {