From: Marco Costalba Date: Thu, 7 Jan 2010 10:59:32 +0000 (+0100) Subject: Fix 'position ..... moves ' parsing bug X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=7c0679ad61d7787dc3a3326551acbdf6658db0b0;hp=7c0679ad61d7787dc3a3326551acbdf6658db0b0 Fix 'position ..... moves ' parsing bug If after 'moves' there is a space then we crash. The problem is that operator>>() trims whitespaces so that after 'moves' has been extract we are still not at eof() but remaining string contains only spaces. So that the next extarction operation uip >> token ends up with unchanged token value that remains 'moves', this garbage value is then feeded to RootPosition.do_move() through move_from_string() that does not detect the invalid move value leading to a crash. This bug is triggered by Shredder 12 interface under Mac that puts a space after 'moves' without any actual move list. Bug fixed by Justin Blanchard After reviewing UCI parsing code I spotted other possible weak points due to the fact that we don't test if the last extract operation has been succesful. So I have extended Justing patch to fix the remaining possible holes in uci.cpp No functional change. Signed-off-by: Marco Costalba ---