Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Panic when calling Patch.String #523

@emersion

Description

@emersion

When calling Patch.String on commit emersion/matcha@cb9c85f, this happens:

runtime error: slice bounds out of range
panic(0x980180, 0xce8540)
	/usr/lib/go/src/runtime/panic.go:489 +0x2cf
gopkg.in/src-d/go-git.v4/plumbing/format/diff.(*hunksGenerator).processEqualsLines(0xc4201178b8, 0xc42015e2c0, 0x1, 0x2, 0x11)
	/home/simon/go/src/gopkg.in/src-d/go-git.v4/plumbing/format/diff/unified_encoder.go:268 +0x355
gopkg.in/src-d/go-git.v4/plumbing/format/diff.(*hunksGenerator).Generate(0xc4201178b8, 0xc420199000, 0x12, 0x20)
	/home/simon/go/src/gopkg.in/src-d/go-git.v4/plumbing/format/diff/unified_encoder.go:183 +0x455
gopkg.in/src-d/go-git.v4/plumbing/format/diff.(*UnifiedEncoder).encodeFilePatch(0xc420193080, 0xc42018f0e0, 0x2, 0x2, 0x1, 0xc420193080)
	/home/simon/go/src/gopkg.in/src-d/go-git.v4/plumbing/format/diff/unified_encoder.go:88 +0x1a8
gopkg.in/src-d/go-git.v4/plumbing/format/diff.(*UnifiedEncoder).Encode(0xc420193080, 0xcb7600, 0xc4201a2ed0, 0x9c9ba0, 0x7fcc01)
	/home/simon/go/src/gopkg.in/src-d/go-git.v4/plumbing/format/diff/unified_encoder.go:71 +0x97
gopkg.in/src-d/go-git.v4/plumbing/object.(*Patch).Encode(0xc4201a2ed0, 0xcb30c0, 0xc42019dd50, 0x0, 0xc420117a28)
	/home/simon/go/src/gopkg.in/src-d/go-git.v4/plumbing/object/patch.go:105 +0x81
gopkg.in/src-d/go-git.v4/plumbing/object.(*Patch).String(0xc4201a2ed0, 0xc4201c60e0, 0xc4201a2ed0)
	/home/simon/go/src/gopkg.in/src-d/go-git.v4/plumbing/object/patch.go:110 +0x7f
github.com/emersion/matcha.(*server).commit(0xc42018eb20, 0xcc2a80, 0xc4201ac150, 0xc4201aa20c, 0x28, 0xa, 0x0)
	/home/simon/go/src/github.com/emersion/matcha/matcha.go:476 +0x279
github.com/emersion/matcha.New.func8(0xcc2a80, 0xc4201ac150, 0xc420036b68, 0x476fb2)
	/home/simon/go/src/github.com/emersion/matcha/matcha.go:526 +0x8c
github.com/labstack/echo.(*Echo).add.func1(0xcc2a80, 0xc4201ac150, 0xcf7d20, 0x28)
	/home/simon/go/src/github.com/labstack/echo/echo.go:467 +0x90
github.com/labstack/echo/middleware.LoggerWithConfig.func2.1(0xcc2a80, 0xc4201ac150, 0x0, 0x0)
	/home/simon/go/src/github.com/labstack/echo/middleware/logger.go:111 +0x12b
github.com/labstack/echo.(*Echo).ServeHTTP.func1(0xcc2a80, 0xc4201ac150, 0xc4200f4bb8, 0xa12520)
	/home/simon/go/src/github.com/labstack/echo/echo.go:558 +0x10e
github.com/labstack/echo.(*Echo).ServeHTTP(0xc4200f4b60, 0xcba500, 0xc4201c6000, 0xc42006c100)
	/home/simon/go/src/github.com/labstack/echo/echo.go:567 +0x24c
net/http.serverHandler.ServeHTTP(0xc420019810, 0xcba500, 0xc4201c6000, 0xc42006c100)
	/usr/lib/go/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc4201b2000, 0xcbadc0, 0xc4201aa0c0)
	/usr/lib/go/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2668 +0x2ce

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions