Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sort): Only filter out nodes with positive offsets. (#8079)
Cherry-picked from #8077. Negative offsets (e.g., offset: -4) can cause panics when sorting. This can happen when the query has the following characteristics: 1. The query is sorting on an indexed predicate 2. The results include nodes that also don't have the sorted predicate 3. A negative offset is used. panic: runtime error: slice bounds out of range [-4:] goroutine 1762633 [running]: github.com/dgraph-io/dgraph/worker.sortWithIndex(0x1fb12e0, 0xc00906a880, 0xc009068660, 0x0) /ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:330 +0x244d github.com/dgraph-io/dgraph/worker.processSort.func2(0x1fb12e0, 0xc00906a880, 0xc009068660, 0xc0090686c0) /ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:515 +0x3f created by github.com/dgraph-io/dgraph/worker.processSort /ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:514 +0x52a
- Loading branch information