Commit 41b72e91 for tesseract
commit 41b72e91297ce10d8dad8883252852478146d4e3
Author: Stefan Weil <sw@weilnetz.de>
Date: Sun Aug 9 13:13:48 2026 +0200
Fix CID 1438688, 1550472 (Integer handling issues)
Abort the loop if AddIntProto returns NO_PROTO instead of using
it as bit index for SET_BIT.
Assisted-by: OpenCode / big-pickle (opencode)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
diff --git a/src/classify/adaptmatch.cpp b/src/classify/adaptmatch.cpp
index b3ef9c25..0aca62c6 100644
--- a/src/classify/adaptmatch.cpp
+++ b/src/classify/adaptmatch.cpp
@@ -714,6 +714,9 @@ void Classify::InitAdaptedClass(TBLOB *Blob, CLASS_ID ClassId, int FontinfoId, A
for (Fid = 0; Fid < Features->NumFeatures; Fid++) {
Pid = AddIntProto(IClass);
assert(Pid != NO_PROTO);
+ if (Pid == NO_PROTO) {
+ break;
+ }
Feature = Features->Features[Fid];
auto TempProto = new TEMP_PROTO_STRUCT;