diff options
| author | tslil clingman <tslil@posteo.de> | 2021-01-17 22:57:28 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | b0b094013a144e6da4c3d3499fd06246085bf853 (patch) | |
| tree | 2dd6027ff2d52d3f81ab675c589585b82bc858c6 | |
| parent | 8915093ce1ed103cc52481118e1ab47bec663236 (diff) | |
Memory oob fix
| -rw-r--r-- | include/ct1986.c | 7 |
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; } |
