Reduce crash risk
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 8 Oct 2025 08:54:59 +0000 (10:54 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 8 Oct 2025 08:54:59 +0000 (10:54 +0200)
Some arrays are enlarged to avoid they will overflow at large search depth.

hachu.c

diff --git a/hachu.c b/hachu.c
index 6ab5442..ee53b1e 100644 (file)
--- a/hachu.c
+++ b/hachu.c
@@ -168,7 +168,7 @@ int retMSP, retFirst, retDep, pvPtr, level, cnt50, mobilityScore;
 int ll, lr, ul, ur; // corner squares\r
 int nodes, startTime, lastRootMove, lastRootIter, tlim1, tlim2, tlim3, repCnt, comp, abortFlag;\r
 Move ponderMove;\r
-Move retMove, moveStack[20000], path[100], repStack[300], pv[1000], repeatMove[300], killer[100][2];\r
+Move retMove, moveStack[80000], path[200], repStack[400], pv[10000], repeatMove[300], killer[200][2];\r
 \r
       int maxDepth;                            // used by search\r
 \r
@@ -3033,7 +3033,7 @@ pboard(board);
          }\r
           continue;\r
         }\r
-        if(!strcmp(command, "sd"))      { sscanf(inBuf, "sd %d", &maxDepth);    continue; }\r
+        if(!strcmp(command, "sd"))      { sscanf(inBuf, "sd %d", &maxDepth); maxDepth &= 63; continue; }\r
         if(!strcmp(command, "st"))      { sscanf(inBuf, "st %d", &timePerMove); continue; }\r
 \r
         if(!strcmp(command, "memory"))  { SetMemorySize(atoi(inBuf+7)); continue; }\r