mercurial/patch.py
branchstable
changeset 16522 a8065323c003
parent 16506 fc4e0fecf403
child 16523 727068417b95
--- a/mercurial/patch.py	Thu Apr 26 14:24:46 2012 +0200
+++ b/mercurial/patch.py	Sat Apr 21 19:58:18 2012 +0200
@@ -1051,7 +1051,11 @@
                 l = ord(l) - ord('A') + 1
             else:
                 l = ord(l) - ord('a') + 27
-            dec.append(base85.b85decode(line[1:-1])[:l])
+            try:
+                dec.append(base85.b85decode(line[1:-1])[:l])
+            except ValueError, e:
+                raise PatchError(_('could not decode binary patch: %s')
+                                 % str(e))
             line = lr.readline()
             self.hunk.append(line)
         text = zlib.decompress(''.join(dec))