Skip to content

image/jpeg: panic while decoding a JPEG image #4259

@gopherbot

Description

@gopherbot

by samuel.stauffer:

With the latest tip version of go (as of yesterday), I get a panic when decoding the
attached JPEG image. The image is grayscale and quite possibly corrupt.

When i try with go 1.0.3 I get an error returned with no panic. The error is:
"invalid JPEG format: missing 0xff00 sequence"

The panic:

panic: runtime error: index out of range

goroutine 1 [running]:
image/jpeg.(*decoder).processSOS(0x421bf000, 0x6, 0x421c44b8, 0x40000000002, 0x2, ...)
    /Users/samuelks/go/src/pkg/image/jpeg/scan.go:295 +0xdf6
image/jpeg.(*decoder).decode(0x421bf000, 0x4218f9c0, 0x421bd000, 0xbc700, 0x0, ...)
    /Users/samuelks/go/src/pkg/image/jpeg/reader.go:275 +0x74d
image/jpeg.Decode(0x4218f9c0, 0x421bd000, 0x421bd000, 0x4218f9c0, 0x421bd000, ...)
    /Users/samuelks/go/src/pkg/image/jpeg/reader.go:299 +0x4d
image.Decode(0x4218f900, 0x4219f100, 0x4219f100, 0x4218f900, 0x4219f100, ...)
    /Users/samuelks/go/src/pkg/image/format.go:84 +0x137
main.main()
    /Users/samuelks/Dropbox/ImageTestData/imgtest.go:19 +0x21c

Attachments:

  1. 718065-crash.jpeg (27917 bytes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions