]> git.sesse.net Git - stockfish/commit
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)
commit5ca428402793b07b432b006056a1368f359c4ea0
tree8fdaea19edadf7003abc444c35443b75cfc09066
parentdac1bcab9007e0fe4c73fda4d6e5ac5b9add435c
Fix a possible crash in thread_is_available()

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>
src/search.cpp
src/thread.h