From fb04cc7dbd619589e45180e1a017c8039ecd9342 Mon Sep 17 00:00:00 2001 From: Norwin Date: Mon, 12 Jul 2021 20:22:27 +0000 Subject: [PATCH] Validate Issue Index before querying DB (#16406) --- models/issue.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/issue.go b/models/issue.go index b9643ae00..225dfee20 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1018,6 +1018,9 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string) // 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,