From eca0079ec91514049034728df2b91a26566a5d89 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 30 Aug 2005 12:23:02 +0000 Subject: [PATCH] Fixed a problem in snippets handling that occurred when using string indexes (problem in zebraExplain_lookup_ord). --- index/extract.c | 5 +++-- index/zinfo.c | 16 +++++++++------- util/zebramap.c | 3 ++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/index/extract.c b/index/extract.c index a7fd69b..ee70256 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1,4 +1,4 @@ -/* $Id: extract.c,v 1.193 2005-08-26 10:13:30 adam Exp $ +/* $Id: extract.c,v 1.194 2005-08-30 12:23:02 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -1539,7 +1539,7 @@ ZEBRA_RES zebra_snippets_rec_keys(ZebraHandle zh, struct recKeys *reckeys, char *dst = (char*) &key; char dst_buf[IT_MAX_WORD]; char *dst_term = dst_buf; - int index_type, ord; + int index_type = 0, ord; iscz1_decode(decode_handle, &dst, &src); assert(key.len <= 4 && key.len > 2); @@ -1549,6 +1549,7 @@ ZEBRA_RES zebra_snippets_rec_keys(ZebraHandle zh, struct recKeys *reckeys, zebraExplain_lookup_ord(zh->reg->zei, ord, &index_type, 0/* db */, 0/* set */, 0/* use */); + assert(index_type); zebra_term_untrans_iconv(zh, nmem, index_type, &dst_term, src); zebra_snippets_append(snippets, seqno, ord, dst_term); diff --git a/index/zinfo.c b/index/zinfo.c index e13b8c3..2d01170 100644 --- a/index/zinfo.c +++ b/index/zinfo.c @@ -1,4 +1,4 @@ -/* $Id: zinfo.c,v 1.50 2005-08-26 10:13:31 adam Exp $ +/* $Id: zinfo.c,v 1.51 2005-08-30 12:23:02 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -1425,15 +1425,17 @@ int zebraExplain_lookup_ord (ZebraExplainInfo zei, int ord, { struct zebSUInfoB *zsui = zdb->attributeDetails->SUInfo; for ( ;zsui; zsui = zsui->next) - if (zsui->info.which == ZEB_SU_SET_USE && - zsui->info.ordinal == ord) + if (zsui->info.ordinal == ord) { if (db) *db = zdb->databaseName; - if (set) - *set = zsui->info.u.su.set; - if (use) - *use = zsui->info.u.su.use; + if (zsui->info.which == ZEB_SU_SET_USE) + { + if (set) + *set = zsui->info.u.su.set; + if (use) + *use = zsui->info.u.su.use; + } if (index_type) *index_type = zsui->info.index_type; return 0; diff --git a/util/zebramap.c b/util/zebramap.c index 30f74c6..238c034 100644 --- a/util/zebramap.c +++ b/util/zebramap.c @@ -1,4 +1,4 @@ -/* $Id: zebramap.c,v 1.42 2005-06-15 21:31:45 adam Exp $ +/* $Id: zebramap.c,v 1.43 2005-08-30 12:23:02 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -189,6 +189,7 @@ ZebraMaps zebra_maps_open (Res res, const char *base) struct zebra_map *zebra_map_get (ZebraMaps zms, unsigned reg_id) { + assert(reg_id >= 0 && reg_id <= 255); return zms->lookup_array[reg_id]; } -- 1.7.10.4