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: image block is out of bounds #10676

Closed
dvyukov opened this issue May 3, 2015 · 1 comment
Closed

image/gif: image block is out of bounds #10676

dvyukov opened this issue May 3, 2015 · 1 comment
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented May 3, 2015

The following program crashes with "image block is out of bounds". Either Decode should not produce such image, or Encode should accept it.

package main

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

func main() {
    img, err := gif.Decode(strings.NewReader(data))
    if err != nil {
        return
    }
    var w bytes.Buffer
    err = gif.Encode(&w, img, nil)
    if err != nil {
        panic(err)
    }
}

var data = "GIF89a0000000,0\x000\x00\x1e\x00" +
    "\x14\x00\x8600000000000000000" +
    "00000000000000000000" +
    "00000000000000000000" +
    "00000000000000000000" +
    "00000000000000000000" +
    "00000000000000000000" +
    "00000000000000000000" +
    "00000000000000000000" +
    "00000U\xa1\xb1$\x9b\x9e\x97\xb97,\xaf\x1ay\xa4\x14" +
    "\xea3\x96\x97\xc6e_\x10G\x8eS\xd2Mm\xa9\xa0\x19\xefF\xfe" +
    "\x97ợ.\xd0;0\x97\x14\xd50v!\xfbȒ\xe2ߗ" +
    "_}\x99`\v״\x98\xa8\xe0\xbdݺ\xaa\xce6\xd2MT " +
    "p\xe03\xdb\x10?J\xa8\xbe\xdc\xd1\x13\x89f\x05\xc4n;\xf3\x1c" +
    "\b5\xe0\x91\xdf\xde\x12qE<\xd6P\xf1O\x88\x8aD\xdf\u007f\xbc" +
    "\xc9Ͱ\x99\xb7\xe7n\u008dN9l\xca\xd0k8\x8e\xee\x84\xcb" +
    "\xbd\xf6K\x03\xc2s\x80|\xfb\xe91r\xbc\xfb\xeeu\x12r\u007f\xc0" +
    "}ȩ\xad\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
    "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
    "\x00\x00\x00\x00\x00\x00\x00\a$F\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b" +
    "\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" +
    "\xa0\xa1\xa2\x85\x81\x00;"
panic: gif: image block is out of bounds

goroutine 1 [running]:
main.main()
    gif.go:17 +0x19d

go version devel +fbb4c74 Sat May 2 02:48:32 2015 +0000 darwin/amd64

@dvyukov dvyukov added this to the Go1.5 milestone May 3, 2015
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/9712 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
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

3 participants