Explorar el Código

Add explicit stack size limit in python turmit

Yann Weber hace 5 años
padre
commit
a7ff0da428
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3
    1
      gte/turmit.py

+ 3
- 1
gte/turmit.py Ver fichero

@@ -42,6 +42,8 @@ class Turmit(object):
42 42
         #  @note This limit is handled by @ref rpnlib.RpnOp()
43 43
         self._signed_int = True
44 44
 
45
+        self._stack_max = 0xFFF
46
+
45 47
         if 'max_int' in kwargs:
46 48
             v = kwargs['max_int']
47 49
             if v < 1:
@@ -273,7 +275,7 @@ class Turmit(object):
273 275
         '''
274 276
 	    
275 277
         stksz = len(self._stack)
276
-        new_sz %= 0xFFF
278
+        new_sz %= self._stack_max
277 279
         if new_sz < 2:
278 280
             new_sz = 2
279 281
         if new_sz > stksz:

Loading…
Cancelar
Guardar