# HG changeset patch # User Augie Fackler # Date 2011-05-24 18:30:10 # Node ID 639f26cab2f5776d93ab33c3a92c9f88b03e5f2b # Parent 137b03b5aea16ecc34d6ecef90460b86ce20b84a 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. diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -56,6 +56,9 @@ def parse_index2(data, inline): n += 1 off += s + if off != len(data): + raise ValueError('corrupt index file') + if index: e = list(index[0]) type = gettype(e[0])