Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image/gif: Disposal is corrupted after round trip #11288

Closed
dvyukov opened this issue Jun 19, 2015 · 1 comment
Closed

image/gif: Disposal is corrupted after round trip #11288

dvyukov opened this issue Jun 19, 2015 · 1 comment

Comments

@dvyukov
Copy link
Member

dvyukov commented Jun 19, 2015

The following program:

package main

import (
    "bytes"
    "fmt"
    "image/gif"
)

func main() {
    data := []byte("GIF87au\x010\x00\xe800000000!" +
        "\xf9000000,0\x000\x000\x00\x00\x000\x02\b\r" +
        "0000000\x00!\xf90\x00\x00\x0000,0\x000" +
        "\x000\x00\x00\x000\x02\b\r0000000\x00;")
    img, err := gif.DecodeAll(bytes.NewReader(data))
    if err != nil {
        return
    }
    w := new(bytes.Buffer)
    err = gif.EncodeAll(w, img)
    if err != nil {
        panic(err)
    }
    img1, err := gif.DecodeAll(w)
    if err != nil {
        panic(err)
    }
    fmt.Printf("LoopCount: %v -> %v\n", img.Disposal, img1.Disposal)
}

prints:

LoopCount: [4 0] -> [4 4]

Disposal must be preserved after Encode/Decode.

go version devel +514014c Thu Jun 18 15:54:35 2015 +0200 linux/amd64

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jun 19, 2015
@rsc rsc modified the milestones: Unplanned, Go1.6 Nov 5, 2015
@andybons
Copy link
Member

gif.DecodeAll now returns an error with this input: https://play.golang.org/p/ayU0ZmlaCwk

invalid graphic control extension block size: 48

@golang golang locked and limited conversation to collaborators Feb 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants