Browse Source

Raise proper error when object size is not an integer.

Jelmer Vernooij 6 years ago
parent
commit
eb1fe9c193
1 changed files with 4 additions and 1 deletions
  1. 4 1
      dulwich/objects.py

+ 4 - 1
dulwich/objects.py

@@ -259,7 +259,10 @@ class ShaFile(object):
             start = len(header)
         header = header[:end]
         type_name, size = header.split(b' ', 1)
-        size = int(size)  # sanity check
+        try:
+            int(size)  # sanity check
+        except ValueError as e:
+            raise ObjectFormatException("Object size not an integer: %s" % e)
         obj_class = object_class(type_name)
         if not obj_class:
             raise ObjectFormatException("Not a known type: %s" % type_name)