Commit feebf4e8 for tesseract

commit feebf4e8ea666dd742383fa26ac782cb3149994b
Author: Stefan Weil <sw@weilnetz.de>
Date:   Fri Nov 13 21:26:30 2026 +0100

    ccmain: fix the index of the lengths in check_abbreviation

    Since commit 098d8d754 the loops in check_abbreviation() used the
    byte offset into the word also as the index into the array of
    character lengths, and incremented it twice in one expression. For a
    word like "I.B.M.A.B.C.D.E.F." the index ran past the end of the
    lengths, so the code read behind the copy of the word, which usually
    ended in an exception (std::length_error).

    Use a separate character index, like the code did before that commit.

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

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

diff --git a/src/ccmain/control.cpp b/src/ccmain/control.cpp
index 6b81b17f..875d7cf5 100644
--- a/src/ccmain/control.cpp
+++ b/src/ccmain/control.cpp
@@ -1908,20 +1908,21 @@ ACCEPTABLE_WERD_TYPE Tesseract::check_abbreviation(const UNICHARSET &char_set, c
                                                    ACCEPTABLE_WERD_TYPE word_type) {
   if (word_type == AC_UNACCEPTABLE) {
     /* Look for abbreviation string */
+    int i = 0;
     int offset = 0;
     if (s[0] != '\0' && char_set.get_isupper(s, lengths[0])) {
       word_type = AC_UC_ABBREV;
-      while (s[offset] != '\0' && char_set.get_isupper(s + offset, lengths[offset]) &&
-             lengths[offset + 1] == 1 && s[offset + lengths[offset]] == '.') {
-        offset += lengths[offset++];
-        offset += lengths[offset++];
+      while (s[offset] != '\0' && char_set.get_isupper(s + offset, lengths[i]) &&
+             lengths[i + 1] == 1 && s[offset + lengths[i]] == '.') {
+        offset += lengths[i++];
+        offset += lengths[i++];
       }
     } else if (s[0] != '\0' && char_set.get_islower(s, lengths[0])) {
       word_type = AC_LC_ABBREV;
-      while (s[offset] != '\0' && char_set.get_islower(s + offset, lengths[offset]) &&
-             lengths[offset + 1] == 1 && s[offset + lengths[offset]] == '.') {
-        offset += lengths[offset++];
-        offset += lengths[offset++];
+      while (s[offset] != '\0' && char_set.get_islower(s + offset, lengths[i]) &&
+             lengths[i + 1] == 1 && s[offset + lengths[i]] == '.') {
+        offset += lengths[i++];
+        offset += lengths[i++];
       }
     }
     if (s[offset] != '\0') {