Commit 6579eee3 for tesseract
commit 6579eee3ae451282ab3477d8e354407c1883dc3c
Author: Stefan Weil <sw@weilnetz.de>
Date: Sun Aug 9 13:28:36 2026 +0200
Fix CID 1550470 (Overflowed integer argument)
Compute the 1-based model index in 64 bit to avoid integer
overflow before converting it to a string.
Assisted-by: OpenCode / big-pickle (opencode)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
diff --git a/src/ccmain/paragraphs.cpp b/src/ccmain/paragraphs.cpp
index 39aaa3e4..012fc62d 100644
--- a/src/ccmain/paragraphs.cpp
+++ b/src/ccmain/paragraphs.cpp
@@ -535,7 +535,7 @@ void RowScratchRegisters::AppendDebugInfo(const ParagraphTheory &theory,
model_string += ",";
}
if (StrongModel(hypothese.model)) {
- model_string += std::to_string(1 + theory.IndexOf(hypothese.model));
+ model_string += std::to_string(static_cast<int64_t>(theory.IndexOf(hypothese.model)) + 1);
} else if (hypothese.model == kCrownLeft) {
model_string += "CrL";
} else if (hypothese.model == kCrownRight) {