From: Adam Dickmeiss Date: Mon, 21 May 2012 14:21:01 +0000 (+0200) Subject: Bounds check terms based in ICU norm X-Git-Tag: v2.0.51~7 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;ds=sidebyside;h=78f1b5bb001da9494f6a4af717182ff7a835c9cd;p=idzebra-moved-to-github.git Bounds check terms based in ICU norm --- 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;