Commit 87124e6b authored by Martijn Pieters's avatar Martijn Pieters

Merge Coll #605 fix from 2.6 branch.

parent cfbce411
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
__doc__='''Tree manipulation classes __doc__='''Tree manipulation classes
$Id: Tree.py,v 1.8 2002/10/03 21:50:17 mj Exp $''' $Id: Tree.py,v 1.9 2002/10/04 14:47:54 mj Exp $'''
__version__='$Revision: 1.8 $'[11:-2] __version__='$Revision: 1.9 $'[11:-2]
from Acquisition import Explicit from Acquisition import Explicit
from ComputedAttribute import ComputedAttribute from ComputedAttribute import ComputedAttribute
...@@ -200,6 +200,9 @@ def decodeExpansion(s, nth=None): ...@@ -200,6 +200,9 @@ def decodeExpansion(s, nth=None):
If nth is an integer, also return the (map, key) pair for the nth entry. If nth is an integer, also return the (map, key) pair for the nth entry.
''' '''
if len(s) > 8192: # Set limit to 8K, to avoid DoS attacks.
raise ValueError('Encoded node map too large')
map = m = {} map = m = {}
mstack = [] mstack = []
pop = 0 pop = 0
...@@ -207,7 +210,7 @@ def decodeExpansion(s, nth=None): ...@@ -207,7 +210,7 @@ def decodeExpansion(s, nth=None):
if nth is not None: if nth is not None:
nth_pair = (None, None) nth_pair = (None, None)
for step in s.split(':'): for step in s.split(':'):
if step == len(step) * '_': if step[0] == '_':
pop = len(step) - 1 pop = len(step) - 1
continue continue
if pop < 0: if pop < 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment