Error in Tree Listing #847

Closed
opened 2025-11-02 03:38:53 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @shyim on GitHub (Jun 26, 2017).

Description

After switching 5 level on webinterface it responds with a 500 exception. I can share a account private on discord to access the gitea server.

Originally created by @shyim on GitHub (Jun 26, 2017). - Gitea version (or commit ref): 5db8cf3 - Git version: 2.11.0 - Operating system: Raspian - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [X] Yes (provide example URL) - [ ] No - [] Not relevant https://try.gitea.io/shyimtest/gs/src/master/src/GSS/Component/Hosting/Gameserver/Games - Log gist: https://dpaste.de/yjHQ/raw ## Description After switching 5 level on webinterface it responds with a 500 exception. I can share a account private on discord to access the gitea server.
GiteaMirror added the type/bug label 2025-11-02 03:38:53 -06:00
Author
Owner

@lafriks commented on GitHub (Jun 26, 2017):

Seems to be working fine - https://try.gitea.io/lafriks/test/src/test_levels

@lafriks commented on GitHub (Jun 26, 2017): Seems to be working fine - https://try.gitea.io/lafriks/test/src/test_levels
Author
Owner

@shyim commented on GitHub (Jun 26, 2017):

I pushed it as private repository on https://try.gitea.io/shyimtest/gs/src/master/src/GSS/Component/Hosting/Gameserver/Games it crashes also :)
I guess admins can access also private repositories

@shyim commented on GitHub (Jun 26, 2017): I pushed it as private repository on https://try.gitea.io/shyimtest/gs/src/master/src/GSS/Component/Hosting/Gameserver/Games it crashes also :) I guess admins can access also private repositories
Author
Owner

@bkcsoft commented on GitHub (Jun 26, 2017):

I guess admins can access also private repositories

Indeed we can 😉 (But we can also check logs which is usually more useful :trollface: )

[Macaron] PANIC: runtime error: slice bounds out of range
/usr/lib/go/src/runtime/panic.go:489 (0x557d0971a0d3)
/usr/lib/go/src/runtime/panic.go:35 (0x557d09718d80)
/srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tree_entry.go:222 (0x557d09ae2450)
/srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tree_entry.go:267 (0x557d09ae269c)
/srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tree_entry.go:239 (0x557d09ae24bd)
/srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tree_entry.go:179 (0x557d09ae1a96)
/srv/app/src/code.gitea.io/gitea/routers/repo/view.go:51 (0x557d0a1646e0)
/srv/app/src/code.gitea.io/gitea/routers/repo/view.go:308 (0x557d0a168a30)
/srv/app/src/code.gitea.io/gitea/routers/repo/view.go:262 (0x557d0a1685ba)
/usr/lib/go/src/runtime/asm_amd64.s:514 (0x557d0974758a)
/usr/lib/go/src/reflect/value.go:434 (0x557d097aa391)
/usr/lib/go/src/reflect/value.go:302 (0x557d097a9936)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x557d09b48ed1)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x557d09b4888c)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x557d09b75d24)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x557d09b75c48)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/session/session.go:186 (0x557d09bcdde2)
/usr/lib/go/src/runtime/asm_amd64.s:514 (0x557d0974758a)
/usr/lib/go/src/reflect/value.go:434 (0x557d097aa391)
/usr/lib/go/src/reflect/value.go:302 (0x557d097a9936)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x557d09b48ed1)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x557d09b4888c)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x557d09b75d24)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x557d09b75c48)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/recovery.go:161 (0x557d09b88fad)
/usr/lib/go/src/runtime/asm_amd64.s:514 (0x557d0974758a)
/usr/lib/go/src/reflect/value.go:434 (0x557d097aa391)
/usr/lib/go/src/reflect/value.go:302 (0x557d097a9936)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x557d09b48ed1)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x557d09b4888c)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x557d09b75d24)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x557d09b75c48)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/logger.go:43 (0x557d09b88266)
/usr/lib/go/src/runtime/asm_amd64.s:514 (0x557d0974758a)
/usr/lib/go/src/reflect/value.go:434 (0x557d097aa391)
/usr/lib/go/src/reflect/value.go:302 (0x557d097a9936)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x557d09b48ed1)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x557d09b4888c)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x557d09b75d24)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/router.go:184 (0x557d09b8a28b)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/router.go:288 (0x557d09b822ef)
/srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/macaron.go:177 (0x557d09b7a1fe)
/srv/app/src/code.gitea.io/gitea/vendor/github.com/gorilla/context/context.go:141 (0x557d09dd4ded)
/usr/lib/go/src/net/http/server.go:1942 (0x557d099c4936)
/usr/lib/go/src/net/http/server.go:2568 (0x557d099c7214)
/usr/lib/go/src/net/http/server.go:1825 (0x557d099c3484)
/usr/lib/go/src/runtime/asm_amd64.s:2197 (0x557d09749d51)
[Macaron] 2017-06-26 20:25:00: Completed /shyimtest/gs/src/master/src/GSS/Component/Hosting/Gameserver/Games 500 Internal Server Error in 381.292503ms

Another fun thing I notices is that I don't actually get any output in the browser from that link 🤔
While I should be presented with a 500-page it doesn't return any payload at all:

Content-Type		"text/plain; charset=utf-8"
Date			"Mon, 26 Jun 2017 20:27:45 GMT"
x-frame-options		"SAMEORIGIN"
Content-Length		"0" <-- HERE
X-Firefox-Spdy		"h2"
@bkcsoft commented on GitHub (Jun 26, 2017): > I guess admins can access also private repositories Indeed we can 😉 (But we can also check logs which is usually more useful :trollface: ) ``` [Macaron] PANIC: runtime error: slice bounds out of range /usr/lib/go/src/runtime/panic.go:489 (0x557d0971a0d3) /usr/lib/go/src/runtime/panic.go:35 (0x557d09718d80) /srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tree_entry.go:222 (0x557d09ae2450) /srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tree_entry.go:267 (0x557d09ae269c) /srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tree_entry.go:239 (0x557d09ae24bd) /srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tree_entry.go:179 (0x557d09ae1a96) /srv/app/src/code.gitea.io/gitea/routers/repo/view.go:51 (0x557d0a1646e0) /srv/app/src/code.gitea.io/gitea/routers/repo/view.go:308 (0x557d0a168a30) /srv/app/src/code.gitea.io/gitea/routers/repo/view.go:262 (0x557d0a1685ba) /usr/lib/go/src/runtime/asm_amd64.s:514 (0x557d0974758a) /usr/lib/go/src/reflect/value.go:434 (0x557d097aa391) /usr/lib/go/src/reflect/value.go:302 (0x557d097a9936) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x557d09b48ed1) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x557d09b4888c) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x557d09b75d24) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x557d09b75c48) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/session/session.go:186 (0x557d09bcdde2) /usr/lib/go/src/runtime/asm_amd64.s:514 (0x557d0974758a) /usr/lib/go/src/reflect/value.go:434 (0x557d097aa391) /usr/lib/go/src/reflect/value.go:302 (0x557d097a9936) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x557d09b48ed1) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x557d09b4888c) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x557d09b75d24) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x557d09b75c48) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/recovery.go:161 (0x557d09b88fad) /usr/lib/go/src/runtime/asm_amd64.s:514 (0x557d0974758a) /usr/lib/go/src/reflect/value.go:434 (0x557d097aa391) /usr/lib/go/src/reflect/value.go:302 (0x557d097a9936) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x557d09b48ed1) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x557d09b4888c) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x557d09b75d24) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x557d09b75c48) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/logger.go:43 (0x557d09b88266) /usr/lib/go/src/runtime/asm_amd64.s:514 (0x557d0974758a) /usr/lib/go/src/reflect/value.go:434 (0x557d097aa391) /usr/lib/go/src/reflect/value.go:302 (0x557d097a9936) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x557d09b48ed1) /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x557d09b4888c) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x557d09b75d24) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/router.go:184 (0x557d09b8a28b) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/router.go:288 (0x557d09b822ef) /srv/app/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/macaron.go:177 (0x557d09b7a1fe) /srv/app/src/code.gitea.io/gitea/vendor/github.com/gorilla/context/context.go:141 (0x557d09dd4ded) /usr/lib/go/src/net/http/server.go:1942 (0x557d099c4936) /usr/lib/go/src/net/http/server.go:2568 (0x557d099c7214) /usr/lib/go/src/net/http/server.go:1825 (0x557d099c3484) /usr/lib/go/src/runtime/asm_amd64.s:2197 (0x557d09749d51) [Macaron] 2017-06-26 20:25:00: Completed /shyimtest/gs/src/master/src/GSS/Component/Hosting/Gameserver/Games 500 Internal Server Error in 381.292503ms ``` Another fun thing I notices is that I don't actually get _any_ output in the browser from that link 🤔 While I should be presented with a 500-page it doesn't return any payload at all: ``` Content-Type "text/plain; charset=utf-8" Date "Mon, 26 Jun 2017 20:27:45 GMT" x-frame-options "SAMEORIGIN" Content-Length "0" <-- HERE X-Firefox-Spdy "h2" ```
Author
Owner

@bkcsoft commented on GitHub (Jun 26, 2017):

It's exploading here because we're not checking that entryPath[entryNameStartIndex:] is a valid index 🙄

@bkcsoft commented on GitHub (Jun 26, 2017): It's exploading [here](https://github.com/go-gitea/git/blob/master/tree_entry.go#L222) because we're not checking that `entryPath[entryNameStartIndex:]` is a valid index 🙄
Author
Owner

@lafriks commented on GitHub (Jun 26, 2017):

it's actually exploding because instead of path we are getting commit hash that of course does not have any slash in it. I'm debugging this issue right now

@lafriks commented on GitHub (Jun 26, 2017): it's actually exploding because instead of path we are getting commit hash that of course does not have any slash in it. I'm debugging this issue right now
Author
Owner

@lafriks commented on GitHub (Jun 26, 2017):

Problem is in log command that is returning merges that by them self does not have any files so we are getting two hashes in the row, so git log command for dir listing must be called with --no-merges

@lafriks commented on GitHub (Jun 26, 2017): Problem is in log command that is returning merges that by them self does not have any files so we are getting two hashes in the row, so git log command for dir listing must be called with `--no-merges`
Author
Owner

@andreynering commented on GitHub (Jun 28, 2017):

/cc @ethantkoenig

@andreynering commented on GitHub (Jun 28, 2017): /cc @ethantkoenig
Author
Owner

@lunny commented on GitHub (Jun 28, 2017):

resolved by #2074

@lunny commented on GitHub (Jun 28, 2017): resolved by #2074
Author
Owner

@lafriks commented on GitHub (Jun 28, 2017):

Just tested and issue is resolved in master branch 👍

@lafriks commented on GitHub (Jun 28, 2017): Just tested and issue is resolved in master branch :+1:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#847