Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 8016:baaa832fd253
raise RevlogError when parser can't parse the revlog index
Initial patch and test thanks to Nicolas Dumazet.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 06 Apr 2009 19:48:11 +0200 |
parents | 08cabecfa8a8 |
children | 685ce2f7ee35 |
line wrap: on
line diff
--- a/mercurial/revlog.py Tue Mar 31 07:56:28 2009 +0200 +++ b/mercurial/revlog.py Mon Apr 06 19:48:11 2009 +0200 @@ -450,7 +450,10 @@ if self.version == REVLOGV0: self._io = revlogoldio() if i: - d = self._io.parseindex(f, self._inline) + try: + d = self._io.parseindex(f, self._inline) + except (ValueError, IndexError), e: + raise RevlogError(_("index %s is corrupted") % (self.indexfile)) self.index, self.nodemap, self._chunkcache = d # add the magic null revision at -1 (if it hasn't been done already)