1
0
mirror of https://github.com/golang/go synced 2024-11-26 21:01:31 -07:00

runtime: fix integer overflow

The problem happens when end=0, then end-1 is very big number.
Observed with the new scheduler.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7307073
This commit is contained in:
Dmitriy Vyukov 2013-02-08 19:05:19 +04:00
parent 6dfd386005
commit 45636db01b

View File

@ -145,7 +145,7 @@ runtime·parfordo(ParFor *desc)
// See if it has any work.
begin = (uint32)pos;
end = (uint32)(pos>>32);
if(begin >= end-1) {
if(begin+1 >= end) {
begin = end = 0;
break;
}