changeset 14421:639f26cab2f5

pure parsers: properly detect corrupt index files This new Python code should be equivalent in behavior to the if statement at line 312 of parsers.c. Without this, the pure-python parsers improperly ignore truncated revlogs as created in test-verify.t.
author Augie Fackler <durin42@gmail.com>
date Tue, 24 May 2011 13:30:10 -0500
parents 137b03b5aea1
children 2e77525e52d9
files mercurial/pure/parsers.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Tue May 24 14:08:20 2011 +0200
+++ b/mercurial/pure/parsers.py	Tue May 24 13:30:10 2011 -0500
@@ -56,6 +56,9 @@
             n += 1
             off += s
 
+    if off != len(data):
+        raise ValueError('corrupt index file')
+
     if index:
         e = list(index[0])
         type = gettype(e[0])