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

Panic when attempting to load issue with invalid label #14466

Closed
2 of 6 tasks
CirnoT opened this issue Jan 26, 2021 · 1 comment · Fixed by #14623
Closed
2 of 6 tasks

Panic when attempting to load issue with invalid label #14466

CirnoT opened this issue Jan 26, 2021 · 1 comment · Fixed by #14623
Labels

Comments

@CirnoT
Copy link
Contributor

CirnoT commented Jan 26, 2021

  • Gitea version (or commit ref): 1.14.0+dev-605-gd2ea21d0d
  • Git version: 2.30.0
  • Operating system: Docker
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:
2021/01/26 10:41:58 ...els/issue_comment.go:382:LoadLabel() [W] Commit 839 cannot load label 0
2021/01/26 10:41:58 ...els/issue_comment.go:382:LoadLabel() [W] Commit 840 cannot load label 0

Description

template: repo/issue/view_content/comments:188:51: executing "repo/issue/view_content/comments" at <RenderLabels .AddedLabels>: error calling RenderLabels: runtime error: invalid memory address or nil pointer dereference

Additionally; this is a very old issue that might've had some labels before migrating to org-labels; possibly need migration or doctor command to address this issue.

@CirnoT
Copy link
Contributor Author

CirnoT commented Jan 30, 2021

delete from comment where type = 7 and label_id = 0;

Seems to have solved the issue. The relevant issues/PRs are from around ~2018.

zeripath added a commit to zeripath/gitea that referenced this issue Feb 9, 2021
There are possibly a few old databases out there with malmigrated data that can
cause panics with empty labels being migrated.

This PR adds a few tests to prevent nil labels being added.

Fix go-gitea#14466

Signed-off-by: Andrew Thornton <art27@cantab.net>
lunny pushed a commit that referenced this issue Feb 10, 2021
* Prevent adding nil label to .AddedLabels or .RemovedLabels

There are possibly a few old databases out there with malmigrated data that can
cause panics with empty labels being migrated.

This PR adds a few tests to prevent nil labels being added.

Fix #14466

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

* Add doctor command to remove the broken label comments

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

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

2 participants