changeset 8640:8536119f2f94

dirstate: notice truncated parents read
author Matt Mackall <mpm@selenic.com>
date Mon, 25 May 2009 12:48:15 -0500
parents 1323dddf8078
children 33686ef26f04
files mercurial/dirstate.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Mon May 25 10:44:37 2009 -0500
+++ b/mercurial/dirstate.py	Mon May 25 12:48:15 2009 -0500
@@ -75,6 +75,8 @@
             st = self._opener("dirstate").read(40)
             if len(st) == 40:
                 return st[:20], st[20:40]
+            if len(st) < 40:
+                raise util.Abort(_('working directory state appears damaged!'))
         except IOError, err:
             if err.errno != errno.ENOENT: raise
         return [nullid, nullid]