changeset 3078:baa3873eb387

don't let lazyparser read more data than it can handle This should fix issue368.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 10 Sep 2006 19:15:08 -0300
parents ad6aecaf4eed
children 4c9fcb5e3b82
files mercurial/revlog.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sat Sep 09 12:56:08 2006 +0200
+++ b/mercurial/revlog.py	Sun Sep 10 19:15:08 2006 -0300
@@ -139,6 +139,11 @@
         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