1
0
mirror of https://github.com/golang/go synced 2024-11-18 07:04:52 -07:00

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 <cmang@golang.org>
This commit is contained in:
Robert Griesemer 2015-10-22 10:08:45 -07:00
parent 3319ea98cd
commit 4e777c8eff

View File

@ -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' {