mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Improve CLI error handling a bit
Reduce the number of *easy* ways to hit UB or an uncaught exception. This builds on Sopel's work on FEN validation. Obviously SF is not and will never be a security boundary, but at least we can reduce the number of reports about uncaught `std::stoi` out of range, etc. I also added a gentle fallback to `NumaConfig` specifically because that's something that (as a dev) I frequently set by hand in the CLI, but happy to revert if that's too annoying of a change. closes https://github.com/official-stockfish/Stockfish/pull/6844 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
48a9118251
commit
cd75d31127
+2
-4
@@ -1593,7 +1593,7 @@ bool Position::upcoming_repetition(int ply) const {
|
||||
|
||||
// Flips position with the white and black sides reversed. This
|
||||
// is only useful for debugging e.g. for finding evaluation symmetry bugs.
|
||||
void Position::flip() {
|
||||
std::optional<PositionSetError> Position::flip() {
|
||||
|
||||
string f, token;
|
||||
std::stringstream ss(fen());
|
||||
@@ -1622,9 +1622,7 @@ void Position::flip() {
|
||||
std::getline(ss, token); // Half and full moves
|
||||
f += token;
|
||||
|
||||
set(f, is_chess960(), st);
|
||||
|
||||
assert(pos_is_ok());
|
||||
return set(f, is_chess960(), st);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user