Skip to content

compare: index out of range panic on master and v1.11 #9807

Closed
@silverwind

Description

@silverwind
  • Gitea version (or commit ref): cc2916d
  • Git version: 2.22.0
  • Operating system: Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

Panic when opening a page compare/master...branch. Stack looks similar to #9173 and #9217 but #9187 did not fix it. I can reproduce on both master and v1.11 release branch. I can't share the diff, but may be able to answer questions about it.

2020/01/17 02:12:33 ...les/context/panic.go:35:1() [E] PANIC:: runtime error: index out of range [-1]
  /usr/lib/golang/src/runtime/panic.go:75 (0x42f8b2)
    goPanicIndex: panic(boundsError{x: int64(x), signed: true, y: y, code: boundsIndex})
  gitea/services/gitdiff/gitdiff.go:358 (0x12fdf83)
  gitea/services/gitdiff/gitdiff.go:870 (0x1301c74)
  gitea/services/gitdiff/gitdiff.go:811 (0x1404a2f)
  gitea/routers/repo/compare.go:282 (0x1404984)
  gitea/routers/repo/compare.go:387 (0x1405f33)
  /usr/lib/golang/src/reflect/value.go:460 (0x491b15)
    Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
  /usr/lib/golang/src/reflect/value.go:321 (0x4912d3)
    Value.Call: return v.call("Call", in)
  gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x9b0ef9)
  gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x9b08a9)
  gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x9e1a78)
  gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0xfc8f01)
  gitea/modules/context/repo.go:576 (0xfc8eea)
  /usr/lib/golang/src/reflect/value.go:460 (0x491b15)
    Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
  /usr/lib/golang/src/reflect/value.go:321 (0x4912d3)
    Value.Call: return v.call("Call", in)
  gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x9b0ef9)
  gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x9b08a9)
  gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x9e1a78)
  gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0xfc68f1)
  gitea/modules/context/panic.go:39 (0xfc68dd)
  /usr/lib/golang/src/reflect/value.go:460 (0x491b15)
    Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
  /usr/lib/golang/src/reflect/value.go:321 (0x4912d3)
    Value.Call: return v.call("Call", in)
  gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x9b0ef9)
  gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x9b08a9)
  gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x9e1a78)
  gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0xa79cd5)
#!/bin/bash
  gitea/vendor/gitea.com/macaron/session/session.go:192 (0xa79cc0)
  gitea/vendor/gitea.com/macaron/macaron/context.go:79 (0x9e1920)
  gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x9b0c09)
  gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x9b0998)
  gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x9e1a78)
  gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0x9f3059)
  gitea/vendor/gitea.com/macaron/macaron/recovery.go:161 (0x9f3047)
  gitea/vendor/gitea.com/macaron/macaron/logger.go:40 (0x9e55f3)
  gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x9b0c09)
  gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x9b0998)
  gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x9e1a78)
  gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0x9f2390)
  gitea/vendor/gitea.com/macaron/macaron/logger.go:52 (0x9f237b)
  gitea/vendor/gitea.com/macaron/macaron/logger.go:40 (0x9e55f3)
  gitea/vendor/gitea.com/macaron/inject/inject.go:157 (0x9b0c09)
  gitea/vendor/gitea.com/macaron/inject/inject.go:135 (0x9b0998)
  gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x9e1a78)
  gitea/vendor/gitea.com/macaron/macaron/router.go:187 (0x9f4276)
  gitea/vendor/gitea.com/macaron/macaron/router.go:303 (0x9edc55)
  gitea/vendor/gitea.com/macaron/macaron/macaron.go:218 (0x9e698a)
  gitea/vendor/github.com/gorilla/context/context.go:141 (0xd1846d)
  /usr/lib/golang/src/net/http/server.go:2007 (0x751bc3)
    HandlerFunc.ServeHTTP: f(w, r)
  /usr/lib/golang/src/net/http/server.go:2802 (0x755013)
    serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
  /usr/lib/golang/src/net/http/server.go:1890 (0x7509b4)
    (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
  /usr/lib/golang/src/runtime/asm_amd64.s:1357 (0x461150)
    goexit: BYTE  $0x90 // NOP

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions