From: Dmitriy Vyukov Date: Fri, 8 Feb 2013 15:05:19 +0000 (+0400) Subject: runtime: fix integer overflow X-Git-Tag: go1.1rc2~1106 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=45636db01bdf4bd50426067af72afbde3900ceb9;p=gostls13.git 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 --- diff --git a/src/pkg/runtime/parfor.c b/src/pkg/runtime/parfor.c index 36dd65852f..d146727430 100644 --- a/src/pkg/runtime/parfor.c +++ b/src/pkg/runtime/parfor.c @@ -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; }