From 58615be5234069af64d28428e39fa77255ad8aba Mon Sep 17 00:00:00 2001 From: Norwin Date: Mon, 12 Jul 2021 20:22:47 +0000 Subject: [PATCH] Validate issue index before querying DB (#16406) (#16410) --- models/issue.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/issue.go b/models/issue.go index 331ea01fdc..f115d76217 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1034,6 +1034,9 @@ func newIssueAttempt(repo *Repository, issue *Issue, labelIDs []int64, uuids []s // GetIssueByIndex returns raw issue without loading attributes by index in a repository. func GetIssueByIndex(repoID, index int64) (*Issue, error) { + if index < 1 { + return nil, ErrIssueNotExist{} + } issue := &Issue{ RepoID: repoID, Index: index,