| Index: src/pkg/archive/zip/reader.go |
| =================================================================== |
| --- a/src/pkg/archive/zip/reader.go |
| +++ b/src/pkg/archive/zip/reader.go |
| @@ -238,7 +238,7 @@ |
| if len(f.Extra) > 0 { |
| b := readBuf(f.Extra) |
| - for len(b) > 0 { |
| + for len(b) > 4 { // need at least tag and size |
| tag := b.uint16() |
| size := b.uint16() |
| if int(size) > len(b) { |
| @@ -259,6 +259,10 @@ |
| } |
| b = b[size:] |
| } |
| + // Should have consumed the whole header. |
| + if len(b) != 0 { |
| + return ErrFormat |
| + } |
| } |
| return nil |
| } |