]> git.sesse.net Git - stockfish/commit
Fix comparison with uninitialized variable
authorSebastian Buchwald <UniQP@web.de>
Tue, 27 Dec 2022 12:33:26 +0000 (13:33 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 1 Jan 2023 11:24:42 +0000 (12:24 +0100)
commitf09b391ceb5ea282538b721b069db67e3b6e098f
treecbd6718dc00a18922e778c39fa5966057aec6e2f
parent64656f8583dde88d558d5367b4cf8fc136c3214a
Fix comparison with uninitialized variable

In both modified methods, the variable 'result' is checked to detect
whether the probe operation failed. However, the variable is not
initialized on all paths, so the check might test an uninitialized
value.

A test position (with TB) is given by:

position fen 3K1k2/R7/8/8/8/8/8/R6Q w - - 0 1 moves a1b1 f8g8 b1a1 g8f8 a1b1 f8g8 b1a1

This is now fixed by always initializing the variable.

closes https://github.com/official-stockfish/Stockfish/pull/4309

No functional change
src/syzygy/tbprobe.cpp