From 45636db01bdf4bd50426067af72afbde3900ceb9 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Fri, 8 Feb 2013 19:05:19 +0400 Subject: [PATCH] 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 --- src/pkg/runtime/parfor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }