From 2d5d3a75f9f251668243bf7ae960bfff3e1731eb Mon Sep 17 00:00:00 2001 From: Naoaki Okazaki Date: Sun, 24 Jan 2016 17:27:54 +0900 Subject: [PATCH] + model->size was not set. + Partially incorporated Pull Request #24. --- lib/crf/src/crf1d_model.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/crf/src/crf1d_model.c b/lib/crf/src/crf1d_model.c index 1c1f14c7..7759d733 100644 --- a/lib/crf/src/crf1d_model.c +++ b/lib/crf/src/crf1d_model.c @@ -713,7 +713,12 @@ static crf1dm_t* crf1dm_new_impl(uint8_t* buffer_orig, const uint8_t* buffer, ui model->buffer_orig = buffer_orig; model->buffer = buffer; + model->size = size; + if (model->size <= sizeof(header_t)) { + goto error_exit; + } + header = (header_t*)calloc(1, sizeof(header_t)); if (header == NULL) { goto error_exit;