Commit 24036579 for tesseract

commit 24036579bd9772458eb2b62ff4d2a53ffef0dca4
Author: Stefan Weil <sw@weilnetz.de>
Date:   Fri Nov 13 22:31:47 2026 +0100

    ccmain: do not abort for a word with more than 512 blobs

    worst_noise_blob() keeps a noise score for each blob of a word in an
    array of 512 entries and checked the number of blobs with
    ASSERT_HOST. For a fixed pitch word which must not be chopped the
    number of blobs is the number of occupied cells of the row, which is
    not limited, so a line of 513 or more characters without a gap
    aborted the process.

    Return -1 (no candidate) for such a word, like for a word which is
    too short. Both callers handle that result.

    Fix proposed by the Anthropic OSS Scanner (finding ANT-2026-Y5LZSKE6).

    Assisted-by: OpenCode / Claude Fable 5.2 (Anthropic)
    Signed-off-by: Stefan Weil <sw@weilnetz.de>

diff --git a/src/ccmain/fixspace.cpp b/src/ccmain/fixspace.cpp
index be74a409..f7d0800a 100644
--- a/src/ccmain/fixspace.cpp
+++ b/src/ccmain/fixspace.cpp
@@ -22,12 +22,12 @@

 #include "blobs.h"          // for TWERD, TBLOB, TESSLINE
 #include "boxword.h"        // for BoxWord
-#include "errcode.h"        // for ASSERT_HOST
 #include "normalis.h"       // for kBlnXHeight, kBlnBaselineOffset
 #include "pageres.h"        // for WERD_RES_IT, WERD_RES, WERD_RES_LIST
 #include "params.h"         // for IntParam, StringParam, BoolParam, DoubleParam, ...
 #include "ratngs.h"         // for WERD_CHOICE, FREQ_DAWG_PERM, NUMBER_PERM
 #include "rect.h"           // for TBOX
+#include "serialis.h"       // for countof
 #include "stepblob.h"       // for C_BLOB_IT, C_BLOB_LIST, C_BLOB
 #include "tesseractclass.h" // for Tesseract, TesseractStats, WordData
 #include "tessvars.h"       // for debug_fp
@@ -706,10 +706,12 @@ int16_t Tesseract::worst_noise_blob(WERD_RES *word_res, float *worst_noise_score

   // Normalised.
   auto blob_count = word_res->box_word->length();
-  ASSERT_HOST(blob_count <= 512);
   if (blob_count < 5) {
     return -1; // too short to split
   }
+  if (blob_count > countof(noise_score)) {
+    return -1; // too long to score
+  }

     /* Get the noise scores for all blobs */