From 78f1b5bb001da9494f6a4af717182ff7a835c9cd Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 21 May 2012 16:21:01 +0200 Subject: [PATCH] Bounds check terms based in ICU norm --- index/extract.c | 5 +++++ index/kinput.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/index/extract.c b/index/extract.c index 6f4a812..a93373c 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1798,6 +1798,11 @@ static void extract_add_icu(RecWord *p, zebra_map_t zm) zebra_map_tokenize_start(zm, p->term_buf, p->term_len); while (zebra_map_tokenize_next(zm, &res_buf, &res_len, 0, 0)) { + if (res_len > IT_MAX_WORD) + { + yaz_log(YLOG_LOG, "Truncating long term %ld", (long) res_len); + res_len = IT_MAX_WORD; + } extract_add_string(p, zm, res_buf, res_len); p->seqno++; } diff --git a/index/kinput.c b/index/kinput.c index ddc58ae..851c13e 100644 --- a/index/kinput.c +++ b/index/kinput.c @@ -328,6 +328,8 @@ static void key_heap_insert(struct heap_info *hi, const char *buf, int nbytes, { int cur, parent; + assert(nbytes < INP_NAME_MAX); + cur = ++(hi->heapnum); memcpy(hi->info.buf[hi->ptr[cur]], buf, nbytes); hi->info.file[hi->ptr[cur]] = kf; -- 1.7.10.4