]> git.sesse.net Git - stockfish/commitdiff
Fix a possible crash in thread_is_available()
authorMarco Costalba <mcostalba@gmail.com>
Mon, 25 Jan 2010 21:18:12 +0000 (22:18 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 25 Jan 2010 22:34:21 +0000 (23:34 +0100)
When we have more then 2 threads then we do an array
access with index 'Threads[slave].activeSplitPoints - 1'
This should be >= 0 because we tested the variable just
few statements before, but because is a shared variable
it could be that the 'slave' thread set the value to zero
just after we test it, so that when we use the decremented
variable for array access we crash.

Bug spotted by Bruno Causse.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>

No differences found