summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/training/gen_k_mixture_model.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/training/gen_k_mixture_model.cpp b/utils/training/gen_k_mixture_model.cpp
index e09abe2..19dd102 100644
--- a/utils/training/gen_k_mixture_model.cpp
+++ b/utils/training/gen_k_mixture_model.cpp
@@ -298,6 +298,10 @@ static bool post_processing_unigram(KMixtureModelBigram * bigram,
KMixtureModelMagicHeader magic_header;
assert(bigram->get_magic_header(magic_header));
+ if ( magic_header.m_total_freq + delta < magic_header.m_total_freq ){
+ fprintf(stderr, "the m_total_freq in magic header overflows.\n");
+ return false;
+ }
magic_header.m_total_freq += total_freq;
assert(bigram->set_magic_header(magic_header));