From 4206aefaed707aa84156c5f31d86050fa40fd13b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 3 May 2005 13:12:38 +0000 Subject: [PATCH] Fixed bug #305: Scanning with negative position. --- index/zrpn.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/index/zrpn.c b/index/zrpn.c index 0ef8529..071a007 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,4 +1,4 @@ -/* $Id: zrpn.c,v 1.141.2.10 2005-04-29 18:56:20 adam Exp $ +/* $Id: zrpn.c,v 1.141.2.11 2005-05-03 13:12:38 adam Exp $ Copyright (C) 1995-2005 Index Data Aps @@ -2792,6 +2792,11 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, { *num_entries -= (after-i); *is_partial = 1; + if (*num_entries <= 0) + { + *num_entries = 0; + return; + } } /* consider terms before main term */ @@ -2875,6 +2880,11 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, *is_partial = 1; *position -= i; *num_entries -= i; + if (*num_entries <= 0) + { + *num_entries = 0; + return; + } } *list = glist + i; /* list is set to first 'real' entry */ -- 1.7.10.4