mcostalba/Stockfish — pull request #88 by tomtor (2013-08-19 09:24:58+00:00)
Title: Fix stack size

In search:

ss->ply = (ss-1)->ply + 1;
ss->futilityMoveCount = 0;
(ss+1)->skipNullMove = false; (ss+1)->reduction = DEPTH_ZERO;
(ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;

and

Stack stack[MAX_PLY_PLUS_3], *ss = stack+2; // To allow referencing (ss-2)

and we abort the search when ply > MAX_PLY but this check is after (ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;

so at ply = 101 we access 3 slots after the end of the stack [MAX_PLY_PLUS_3]

I tested with

const int MAX_PLY_PLUS_3 = MAX_PLY + 6;

and no crash...

last line:

info depth 100 seldepth 101 score cp 0 nodes 15226668 nps 614052 time 24797 multipv 1 pv d1c2 g7h6 c2d2 h6g7 d2c3 g7f6 c3c2 f6g7 c2d3 g7h8 d3e3 h8g7 e3e2 g7h8 e2f3 h8g7 f3e2
info nodes 15226668 time 24797