From b0b094013a144e6da4c3d3499fd06246085bf853 Mon Sep 17 00:00:00 2001 From: tslil clingman Date: Sun, 17 Jan 2021 22:57:28 -0500 Subject: Memory oob fix --- include/ct1986.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/ct1986.c b/include/ct1986.c index 1d1d253..5e1c0fc 100644 --- a/include/ct1986.c +++ b/include/ct1986.c @@ -217,7 +217,12 @@ ct1986_minimax(const uint8_t cur_depth, const uint8_t max_depth, carry = 0; drops[idx]++; do { - if (carry) { drops[++idx]++; carry = 0;} + if (carry) { + idx++; + if (idx >= steps) break; + drops[idx]++; + carry = 0; + } if (drops[idx] > count || drops[idx] > 5) { drops[idx] = 1; carry = 1; } -- cgit v1.2.3