Commit b2597705 for tesseract

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

    ccmain: do not merge the blobs of a word with a single character

    With unlv_tilde_crunching, write_results() merges the first two blobs
    of a word which starts with a space after a word which ended with a
    tilde. It did not check that the word has a second blob. For a
    rejected word with one character MergeAdjacentBlobs(0) failed an
    ASSERT_HOST, which aborted the process.

    Only merge if the word has more than one character.

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

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

diff --git a/src/ccmain/output.cpp b/src/ccmain/output.cpp
index a296bc43..8924ed1c 100644
--- a/src/ccmain/output.cpp
+++ b/src/ccmain/output.cpp
@@ -151,9 +151,10 @@ void Tesseract::write_results(PAGE_RES_IT &page_res_it,

   if (unlv_tilde_crunching && stats_.last_char_was_tilde && (word->word->space() == 0) &&
       !(word->word->flag(W_REP_CHAR) && tessedit_write_rep_codes) &&
-      (word->best_choice != nullptr && word->best_choice->unichar_id(0) == space)) {
+      (word->best_choice != nullptr && word->best_choice->length() > 1 &&
+       word->best_choice->unichar_id(0) == space)) {
     /* Prevent adjacent tilde across words - we know that adjacent tildes within
-   words have been removed */
+   words have been removed. A word without a second blob has nothing to merge. */
     word->MergeAdjacentBlobs(0);
   }
   if (newline_type || (word->word->flag(W_REP_CHAR) && tessedit_write_rep_codes)) {