X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=isamb%2Fisamb.c;h=51a0f98851921c896e4d4ff2594155e363b9ee1c;hb=7a23ff31063e70f55eb387477130a358f0992988;hp=7cd0ea936070e9dc030770ad3932f36e0a579c1b;hpb=161aa7805930f6b91ccea027e4afa4ccce41c379;p=idzebra-moved-to-github.git diff --git a/isamb/isamb.c b/isamb/isamb.c index 7cd0ea9..51a0f98 100644 --- a/isamb/isamb.c +++ b/isamb/isamb.c @@ -1,5 +1,5 @@ -/* $Id: isamb.c,v 1.89 2006-12-18 23:40:08 adam Exp $ - Copyright (C) 1995-2006 +/* $Id: isamb.c,v 1.92 2007-02-24 16:46:22 adam Exp $ + Copyright (C) 1995-2007 Index Data ApS This file is part of the Zebra server. @@ -291,17 +291,20 @@ ISAMB isamb_open2(BFiles bfs, const char *name, int writeflag, ISAMC_M *method, if (memcmp(hbuf, "isamb", 5)) { yaz_log(YLOG_WARN, "bad isamb header for file %s", fname); + isamb_close(isamb); return 0; } if (sscanf(hbuf+5, "%d %d %d", &major, &minor, &len) != 3) { yaz_log(YLOG_WARN, "bad isamb header for file %s", fname); + isamb_close(isamb); return 0; } if (major != ISAMB_MAJOR_VERSION) { yaz_log(YLOG_WARN, "bad major version for file %s %d, must be %d", fname, major, ISAMB_MAJOR_VERSION); + isamb_close(isamb); return 0; } for (left = len - sizes[i]; left > 0; left = left - sizes[i]) @@ -312,6 +315,7 @@ ISAMB isamb_open2(BFiles bfs, const char *name, int writeflag, ISAMC_M *method, yaz_log(YLOG_WARN, "truncated isamb header for " "file=%s len=%d pos=%d", fname, len, pos); + isamb_close(isamb); return 0; } } @@ -632,7 +636,7 @@ static void check_block (ISAMB b, struct ISAMB_block *p) #else zint item_len; decode_item_len(&src, &item_len); - assert (item_len > 0 && item_len < 80); + assert (item_len > 0 && item_len < 128); src += item_len; #endif decode_ptr(&src, &pos); @@ -780,7 +784,7 @@ int insert_int (ISAMB b, struct ISAMB_block *p, void *lookahead_item, #if INT_ENCODE const char *sub_item_ptr = sub_item; #endif - assert (sub_size < 80 && sub_size > 1); + assert (sub_size < 128 && sub_size > 1); memcpy (dst, startp, src - startp); @@ -1277,7 +1281,7 @@ void isamb_merge(ISAMB b, ISAM_P *pos, ISAMC_I *stream) #endif encode_ptr(&dst, p->pos); - assert (sub_size < 80 && sub_size > 1); + assert (sub_size < 128 && sub_size > 1); #if INT_ENCODE (*b->method->codec.reset)(c1); (*b->method->codec.encode)(c1, &dst, &sub_item_ptr);