Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We use following line to clamp the search depth in some range: Depth d = std::clamp(newDepth - r, 1, newDepth + 1); Through negative extension its possible that the maximum value becomes smaller than the minimum value but then the behavior is undefined (see https://en.cppreference.com/w/cpp/algorithm/clamp). So replace this line with a safe implementation. Remark: We have in recent master already one line where up to 3 negative extensions are possible which could trigger this undefined behavior but this can only be happen for completed depth > 24 so its not discovered by our default bench. Recent negative extension tests by @fauzi shows then this undefined behavior with wrong bench numbers. closes official-stockfish#4877 No functional change
- Loading branch information