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

Nil Pointer 500 in compare view #17193

Closed
6543 opened this issue Sep 30, 2021 · 0 comments · Fixed by #17197
Closed

Nil Pointer 500 in compare view #17193

6543 opened this issue Sep 30, 2021 · 0 comments · Fixed by #17197
Labels

Comments

@6543
Copy link
Member

6543 commented Sep 30, 2021

Gitea Info

version: main (3bbdce2)
git: v33.0
os: linux

Gist

PANIC: runtime error: invalid memory address or nil pointer dereference
/usr/lib/go/src/runtime/panic.go:221 (0x44da46)
	panicmem: panic(memoryError)
/usr/lib/go/src/runtime/signal_unix.go:735 (0x44da16)
	sigpanic: panicmem()
/home/maddl/git/own/gitea/routers/web/repo/compare.go:638 (0x1ba4378)
	CompareDiff.func1: if ci.HeadGitRepo != nil {
/home/maddl/git/own/gitea/routers/web/repo/compare.go:643 (0x1ba42cc)
	CompareDiff: return
/home/maddl/git/own/gitea/modules/web/route.go:74 (0x1b53cc4)
	Wrap.func1: t(ctx)
/usr/lib/go/src/net/http/server.go:2046 (0x76190e)
	HandlerFunc.ServeHTTP: f(w, r)
/home/maddl/git/own/gitea/vendor/github.com/go-chi/chi/mux.go:436 (0x138cb58)
	(*Mux).routeHTTP: h.ServeHTTP(w, r)
/usr/lib/go/src/net/http/server.go:2046 (0x76190e)
	HandlerFunc.ServeHTTP: f(w, r)
/home/maddl/git/own/gitea/modules/web/route.go:113 (0x1b544a5)
	Middle.func1.1: next.ServeHTTP(ctx.Resp, ctx.Req)
/usr/lib/go/src/net/http/server.go:2046 (0x76190e)
	HandlerFunc.ServeHTTP: f(w, r)
/home/maddl/git/own/gitea/modules/web/route.go:113 (0x1b544a5)
	Middle.func1.1: next.ServeHTTP(ctx.Resp, ctx.Req)
/usr/lib/go/src/net/http/server.go:2046 (0x76190e)
	HandlerFunc.ServeHTTP: f(w, r)
/home/maddl/git/own/gitea/modules/web/route.go:113 (0x1b544a5)
	Middle.func1.1: next.ServeHTTP(ctx.Resp, ctx.Req)
/usr/lib/go/src/net/http/server.go:2046 (0x76190e)
	HandlerFunc.ServeHTTP: f(w, r)
/home/maddl/git/own/gitea/vendor/github.com/go-chi/chi/middleware/get_head.go:37 (0x1b71304)
	GetHead.func1: next.ServeHTTP(w, r)
/usr/lib/go/src/net/http/server.go:2046 (0x76190e)
	HandlerFunc.ServeHTTP: f(w, r)
/home/maddl/git/own/gitea/modules/web/route.go:113 (0x1b544a5)
	Middle.func1.1: next.ServeHTTP(ctx.Resp, ctx.Req)
/usr/lib/go/src/net/http/server.go:2046 (0x76190e)
	HandlerFunc.ServeHTTP: f(w, r)
/home/maddl/git/own/gitea/modules/context/context.go:747 (0x139dedb)
	Contexter.func1.1: next.ServeHTTP(ctx.Resp, ctx.Req)
/usr/lib/go/src/net/http/server.go:2046 (0x76190e)
	HandlerFunc.ServeHTTP: f(w, r)
/home/maddl/git/own/gitea/vendor/github.com/go-chi/chi/mux.go:70 (0x138a9ad)
	(*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r)
/home/maddl/git/own/gitea/vendor/github.com/go-chi/chi/mux.go:311 (0x138c35b)

Description

should return 404

@6543 6543 added the type/bug label Sep 30, 2021
@6543 6543 changed the title Nil Pointer 500 Nil Pointer 500 in compare view Sep 30, 2021
zeripath added a commit to zeripath/gitea that referenced this issue Sep 30, 2021
If ParseCompareInfo returns a nil compare info the defer function needs to ensure
that it does not attempt to close the HeadGitRepo.

Fix go-gitea#17193

Signed-off-by: Andrew Thornton <art27@cantab.net>
6543 added a commit that referenced this issue Sep 30, 2021
* Prevent NPE on invalid diff

If ParseCompareInfo returns a nil compare info the defer function needs to ensure
that it does not attempt to close the HeadGitRepo.

Fix #17193

Signed-off-by: Andrew Thornton <art27@cantab.net>

* add TEST

Co-authored-by: 6543 <6543@obermui.de>
Chianina pushed a commit to Chianina/gitea that referenced this issue Oct 15, 2021
* Prevent NPE on invalid diff

If ParseCompareInfo returns a nil compare info the defer function needs to ensure
that it does not attempt to close the HeadGitRepo.

Fix go-gitea#17193

Signed-off-by: Andrew Thornton <art27@cantab.net>

* add TEST

Co-authored-by: 6543 <6543@obermui.de>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
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.

1 participant