From: Stefan Nilsson Date: Mon, 4 Mar 2013 15:25:21 +0000 (-0500) Subject: container/heap: fix int overflow bug X-Git-Tag: go1.1rc2~708 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d4a020dec1396ec162f95dd834b358da4a519355;p=gostls13.git container/heap: fix int overflow bug R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7450052 --- diff --git a/src/pkg/container/heap/heap.go b/src/pkg/container/heap/heap.go index 7fd41f785f..c37e50e3c4 100644 --- a/src/pkg/container/heap/heap.go +++ b/src/pkg/container/heap/heap.go @@ -90,7 +90,7 @@ func up(h Interface, j int) { func down(h Interface, i, n int) { for { j1 := 2*i + 1 - if j1 >= n { + if j1 >= n || j1 < 0 { // j1 < 0 after int overflow break } j := j1 // left child