Skip to content

image/png: interface conversion: color.Color is color.NRGBA, not color.RGBA #10423

Description

@dvyukov

Run the following program on the following input:

package main

import (
    "bytes"
    "image/png"
    "io/ioutil"
    "os"
)

func main() {
    data, _ := ioutil.ReadFile(os.Args[1])
    png.Decode(bytes.NewReader(data))
}

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

It crashes as:

panic: interface conversion: color.Color is color.NRGBA, not color.RGBA

goroutine 1 [running]:
runtime.gopanic(0x5176e0, 0xc208010300)
    /ssd/src/go10/src/runtime/panic.go:477 +0x3fe fp=0xc20803dc80 sp=0xc20803dc00
runtime.assertI2T(0x5260c0, 0x7f01b18fe378, 0xc20800f580, 0xc20803dcfc)
    /ssd/src/go10/src/runtime/iface.go:187 +0x1c0 fp=0xc20803dcb0 sp=0xc20803dc80
image/png.(*decoder).parsetRNS(0xc20800d500, 0xad, 0x0, 0x0)
    /ssd/src/go10/src/image/png/reader.go:268 +0x4d8 fp=0xc20803dd88 sp=0xc20803dcb0
image/png.(*decoder).parseChunk(0xc20800d500, 0x0, 0x0)
    /ssd/src/go10/src/image/png/reader.go:690 +0x9e7 fp=0xc20803de68 sp=0xc20803dd88
image/png.Decode(0x7f01b18fe2d8, 0xc208012420, 0x0, 0x0, 0x0, 0x0)
    /ssd/src/go10/src/image/png/reader.go:752 +0x247 fp=0xc20803df08 sp=0xc20803de68
main.main()
    /tmp/png.go:12 +0x10b fp=0xc20803df90 sp=0xc20803df08

I am on commit a5dec38

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions