]> git.sesse.net Git - stockfish/commit
Fix a crash introduced few days ago
authorMarco Costalba <mcostalba@gmail.com>
Fri, 26 Apr 2013 10:12:53 +0000 (12:12 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 26 Apr 2013 10:14:01 +0000 (12:14 +0200)
commite508494a9985a5d54e77df694e8f160bb3346de3
treefa605bfb4dbfddc6fb631118e092fa4e28c87e0a
parent2ef53ee368683d5aa62b028377b94efe961f18ac
Fix a crash introduced few days ago

Crash is due to uninitialized ss->futilityMoveCount that
when happens to be negative, yields to an out of range
access in futility_margin().

Bug is subtle because it shows itself only in SMP case.
Indeed in single thread mode we only use the

Stack ss[MAX_PLY_PLUS_2];

Allocated at the begin of id_loop() and due to pure
(bad) luck, it happens that for all the MAX_PLY_PLUS_2
elements, ss[i].futilityMoveCount >= 0

Note that the patch does not prevent futilityMoveCount
to be overwritten after, for instance singular search
or null verification, but to keep things readable and
because the effect is almost unmeasurable, we here
prefer a slightly incorrect but simpler patch.

bench: 4311634
src/search.cpp