aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2021-01-17 22:57:28 -0500
committertslil <tslil@posteo.de>2021-01-17 22:57:28 -0500
commitfd0128c433ab28012661d1bc4ea14a354c6c37a6 (patch)
tree2dd6027ff2d52d3f81ab675c589585b82bc858c6 /include
parentaf3c5a9094d0c27bb49ec618f2a9a7af5f96f575 (diff)
Memory oob fix
Diffstat (limited to 'include')
-rw-r--r--include/ct1986.c7
1 files changed, 6 insertions, 1 deletions
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;
}