]> Cypherpunks repositories - gostls13.git/commitdiff
image/gif: fix buglet in graphics extension.
authorRob Pike <r@golang.org>
Tue, 7 Jun 2011 12:19:36 +0000 (12:19 +0000)
committerRob Pike <r@golang.org>
Tue, 7 Jun 2011 12:19:36 +0000 (12:19 +0000)
need to ReadFull, not Read, to get extension data.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4576043

src/pkg/image/gif/reader.go

index 9f7296a98bf094ce3896d784dd4865cfcead2a17..26c013b9abde25b6a937bf9cd244fe53666affc9 100644 (file)
@@ -274,7 +274,7 @@ func (d *decoder) readExtension() os.Error {
                return fmt.Errorf("gif: unknown extension 0x%.2x", extension)
        }
        if size > 0 {
-               if _, err := d.r.Read(d.tmp[0:size]); err != nil {
+               if _, err := io.ReadFull(d.r, d.tmp[0:size]); err != nil {
                        return err
                }
        }
@@ -406,8 +406,8 @@ func DecodeAll(r io.Reader) (*GIF, os.Error) {
        return gif, nil
 }
 
-// DecodeConfig returns the color model and dimensions of a GIF image without
-// decoding the entire image.
+// DecodeConfig returns the global color model and dimensions of a GIF image
+// without decoding the entire image.
 func DecodeConfig(r io.Reader) (image.Config, os.Error) {
        var d decoder
        if err := d.decode(r, true); err != nil {