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

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

Closed
2 of 7 tasks
silverwind opened this issue Jan 16, 2020 · 7 comments · Fixed by #9926
Closed
2 of 7 tasks

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

silverwind opened this issue Jan 16, 2020 · 7 comments · Fixed by #9926
Labels
Milestone

Comments

@silverwind
Copy link
Member

silverwind commented Jan 16, 2020

  • 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
@lafriks
Copy link
Member

lafriks commented Jan 16, 2020

Could it be that #9808 fixed this?

@silverwind
Copy link
Member Author

@lunny is it related?

@lunny
Copy link
Member

lunny commented Jan 17, 2020

@silverwind Maybe. I just review the code and found that. Since #9808 merged, could you confirm that? I will send back port to v1.11 and v1.10

@silverwind
Copy link
Member Author

silverwind commented Jan 17, 2020

Unfortunately, no, it does not fix it. Updated stacktrace which is now for cc2916d.

@lunny
Copy link
Member

lunny commented Jan 17, 2020

So there is a file has changes but there is no any section. @silverwind Could you paste that patch?

@silverwind
Copy link
Member Author

Afraid I can not share the private patch data, I'll check it out myself later.

@silverwind silverwind changed the title gitdiff.go:358 index out of range panic on master and v1.11 compare: index out of range panic on master and v1.11 Jan 17, 2020
@silverwind
Copy link
Member Author

silverwind commented Jan 21, 2020

@lunny It can be reproduced with a simple file mode change:

https://try.gitea.io/silverwind/symlink-test/compare/master...mode

$ git diff master mode
diff --git a/file b/file
old mode 100644
new mode 100755

@lafriks lafriks added this to the 1.12.0 milestone Jan 21, 2020
@lafriks lafriks modified the milestones: 1.12.0, 1.11.0 Jan 22, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants