Commit 45636db0 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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
parent 6dfd3860
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment