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

x/image/tiff: index out of range #10394

Closed
dvyukov opened this issue Apr 9, 2015 · 3 comments
Closed

x/image/tiff: index out of range #10394

dvyukov opened this issue Apr 9, 2015 · 3 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Apr 9, 2015

Run the following program on the following input:

package main

import (
    "bytes"
    "io/ioutil"
    "os"
    "golang.org/x/image/tiff"
)

func main() {
    data, _ := ioutil.ReadFile(os.Args[1])
    img, err := tiff.Decode(bytes.NewReader(data))
    if err != nil {
        return
    }
    var w bytes.Buffer
    err = tiff.Encode(&w, img, nil)
    if err != nil {
        panic(err)
    }
}

https://drive.google.com/file/d/0B20Uwp8Hs1oCNXVZbU8zQ2ZaWmM/view?usp=sharing

It crashes with:

panic: runtime error: index out of range

goroutine 1 [running]:
runtime.gopanic(0x52ae80, 0xc20800e210)
    src/runtime/panic.go:477 +0x3fe fp=0xc2080414b8 sp=0xc208041438
runtime.panicindex()
    src/runtime/panic.go:12 +0x52 fp=0xc2080414e0 sp=0xc2080414b8
golang.org/x/image/tiff.(*decoder).readBits(0xc208070000, 0x1, 0x36)
    src/golang.org/x/image/tiff/reader.go:170 +0x104 fp=0xc2080414e8 sp=0xc2080414e0
golang.org/x/image/tiff.(*decoder).decode(0xc208070000, 0x7f2eb8943380, 0xc2080104c0, 0x0, 0x0, 0x99, 0x37, 0x0, 0x0)
    src/golang.org/x/image/tiff/reader.go:251 +0x86e fp=0xc2080416e0 sp=0xc2080414e8
golang.org/x/image/tiff.Decode(0x7f2eb89432d8, 0xc208014480, 0x7f2eb8943380, 0xc2080104c0, 0x0, 0x0)
    src/golang.org/x/image/tiff/reader.go:593 +0xadc fp=0xc208041ed0 sp=0xc2080416e0
main.main()
    /tmp/tiff.go:12 +0x132 fp=0xc208041f90 sp=0xc208041ed0

I am on commit 65a798f031fd31a65574938bed2ec44c2bcba496

@dvyukov dvyukov added this to the Go1.5 milestone Apr 9, 2015
@osocurioso
Copy link
Contributor

Mailed http://golang.org/cl/9257. Need bilevel image or paletted image with BitsPerSample % 8 != 0 to provoke the issue.

@chai2010
Copy link
Contributor

@osocurioso Don't need catch the panic.
It just a shadow err, fixed in http://golang.org/cl/9264

PS:
Sorry, i made a mistake, please ingore this reply.

@nigeltao
Copy link
Contributor

Please review https://go-review.googlesource.com/9278 instead.

@rsc rsc modified the milestones: Unreleased, Go1.5 Apr 26, 2015
chai2010 added a commit to chai2010/tiff that referenced this issue Apr 28, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
mrhyperbit23z0d added a commit to mrhyperbit23z0d/bhegde8 that referenced this issue Jun 6, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
GalaxyForcew added a commit to GalaxyForcew/A1bisshy that referenced this issue Jun 6, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
yi-ge3 added a commit to yi-ge3/wislie that referenced this issue Jun 6, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
balloontmz6 added a commit to balloontmz6/Likewise42l that referenced this issue Jun 6, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
snapbakkhfbav added a commit to snapbakkhfbav/SayedBaladohr that referenced this issue Oct 6, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
MiderWong5ddop added a commit to MiderWong5ddop/sidie88f that referenced this issue Oct 7, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
rorypeckwnt4v added a commit to rorypeckwnt4v/LearnByBhanuPrataph that referenced this issue Oct 7, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
egorovcharenko9 added a commit to egorovcharenko9/RiceBIOC470z that referenced this issue Oct 7, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
RafayGhafoorf added a commit to RafayGhafoorf/dustinsand8 that referenced this issue Oct 7, 2022
Fixes golang/go#10394

Change-Id: I12621650f0c21579047497407ca2745febe4521b
Reviewed-on: https://go-review.googlesource.com/9278
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
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