Skip to content

Commit

Permalink
Fix function Classify::WriteIntTemplates (issue #3965)
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 <[email protected]>
  • Loading branch information
stweil committed Dec 11, 2022
1 parent 1d8626c commit 77573b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/classify/intproto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,13 +919,13 @@ 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) {
tprintf(
"Warning: executing WriteIntTemplates() with %d classes in"
" Templates, while target_unicharset size is %zu\n",
" Templates, while target_unicharset size is %" PRIu32 "\n",
Templates->NumClasses, unicharset_size);
}

Expand Down

0 comments on commit 77573b3

Please sign in to comment.