Skip to content

Commit

Permalink
Fix function Classify::WriteIntTemplates (issue tesseract-ocr#3925)
Browse files Browse the repository at this point in the history
It crashed when running mftraining because unicharset_size in file
"inttemp" was written with 8 bytes instead of 4 bytes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

# Conflicts:
#	src/classify/intproto.cpp
  • Loading branch information
stweil authored and GerHobbelt committed Jan 27, 2023
1 parent 9c8a15f commit 593d86e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/classify/intproto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ void ClearFeatureSpaceWindow(NORM_METHOD norm_method, ScrollView *window) {
void Classify::WriteIntTemplates(FILE *File, INT_TEMPLATES_STRUCT *Templates,
const UNICHARSET &target_unicharset) {
INT_CLASS_STRUCT *Class;
auto unicharset_size = target_unicharset.size();
uint32_t unicharset_size = target_unicharset.size();
int version_id = -5; // When negated by the reader -1 becomes +1 etc.

if (Templates->NumClasses != unicharset_size) {
Expand Down

0 comments on commit 593d86e

Please sign in to comment.