mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Fix memory access in Search::clear()
Fixes a bug in Search::clear, where the filling of CounterMoveStats&, overwrote (currently presumably unused) memory because sizeof(cm) returns the size in bytes, whereas elements was needed. No functional change Closes #1119
This commit is contained in:
committed by
Joona Kiiski
parent
862934d7ae
commit
732aa34e3d
@@ -197,9 +197,10 @@ void Search::clear() {
|
|||||||
th->history.clear();
|
th->history.clear();
|
||||||
th->counterMoveHistory.clear();
|
th->counterMoveHistory.clear();
|
||||||
th->resetCalls = true;
|
th->resetCalls = true;
|
||||||
|
|
||||||
CounterMoveStats& cm = th->counterMoveHistory[NO_PIECE][0];
|
CounterMoveStats& cm = th->counterMoveHistory[NO_PIECE][0];
|
||||||
int* t = &cm[NO_PIECE][0];
|
auto* t = &cm[NO_PIECE][0];
|
||||||
std::fill(t, t + sizeof(cm), CounterMovePruneThreshold - 1);
|
std::fill(t, t + sizeof(cm)/sizeof(*t), CounterMovePruneThreshold - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Threads.main()->previousScore = VALUE_INFINITE;
|
Threads.main()->previousScore = VALUE_INFINITE;
|
||||||
|
|||||||
Reference in New Issue
Block a user