From 13524bea9b7a64dd2881880b2272f3ccd494c262 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Fri, 12 Aug 2011 11:42:08 +0200 Subject: [PATCH] Fix use of uninitialized variable When initializing endgames map we build a faked FEN string in mat_key() to get the position hash's key. This fen string lacks full move numbers, so when parsing the fen in Position::from_fen() we leave startPosPly un-initialized. Spotted by Valgrind (this is a kind of bug that is almost impossible for humans to find). No functional change. Signed-off-by: Marco Costalba --- src/endgame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/endgame.cpp b/src/endgame.cpp index c1c703a3..f8f4c802 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -87,7 +87,7 @@ namespace { do fen += char(tolower(keyCode[i])); while (++i < keyCode.length()); // Add file padding and remaining empty ranks - fen += string(1, '0' + int(8 - keyCode.length())) + "/8/8/8/8/8/8/8 w - -"; + fen += string(1, '0' + int(8 - keyCode.length())) + "/8/8/8/8/8/8/8 w - - 0 10"; // Build a Position out of the fen string and get its material key return Position(fen, false, 0).get_material_key(); -- 2.39.2