Commits

haypo  committed a43d05a

Raise an exception if integer size is bigger than 256 bits

  • Participants
  • Parent commits eb88b8a

Comments (0)

Files changed (1)

File hachoir-core/hachoir_core/field/integer.py

 """
 
 import types
-from hachoir_core.field import Bits
+from hachoir_core.field import Bits, FieldError
 
 class GenericInteger(Bits):
     """
     """
     def __init__(self, parent, name, signed, size, description=None,
     text_handler=None):
-        # WARNING: If you edit this constructor don't forget to edit
-        # Integer constructor (from integerFactory())
+        if 256 < size:
+            raise FieldError("Integer size bigger than 256: %s bits" % size)
         Bits.__init__(self, parent, name, size, description)
         self.signed = signed
         if text_handler: