Browse Source

Add explicit stack size limit in python turmit

Yann Weber 6 years ago
parent
commit
a7ff0da428
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      gte/turmit.py

+ 3
- 1
gte/turmit.py View File

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

Loading…
Cancel
Save