don't let lazyparser read more data than it can handle

This should fix issue368.
This commit is contained in:
Alexis S. L. Carvalho 2006-09-10 19:15:08 -03:00
parent 455c371cc5
commit 38036387d3

View File

@ -139,6 +139,11 @@ class lazyparser(object):
if self.all: return
if data is None:
self.dataf.seek(blockstart)
if blockstart + blocksize > self.datasize:
# the revlog may have grown since we've started running,
# but we don't have space in self.index for more entries.
# limit blocksize so that we don't get too much data.
blocksize = self.datasize - blockstart
data = self.dataf.read(blocksize)
lend = len(data) / self.s
i = blockstart / self.s