[Python-Dev] recursion limit in marshal (original) (raw)
Neal Norwitz nnorwitz at gmail.com
Fri May 18 07:21:05 CEST 2007
- Previous message: [Python-Dev] marshal and ssize_t (PEP 353)
- Next message: [Python-Dev] recursion limit in marshal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I had a little argument with the marshal module on Windows last night, I eventually won. :-)
A patch was checked in which would prevent blowing out the stack and segfaulting with this code:
marshal.loads( 'c' + ('X' * 4*4) + '{' * 2**20)
Originally, I didn't change the recursion limit which was 5000. (See MAX_MARSHAL_STACK_DEPTH in Python/marshal.c) This is a constant in C code that cannot be changed at runtime. The fix worked on most platforms. However it didn't on some (Windows and MIPS?), presumably due a smaller stack limit. I don't know what the stack limits are on each architecture.
I dropped the limit to 4000, that still crashed. I eventually settled on 2000. Which passed in 2.6. I don't think there is a test case for the recursion limit when dumping a deeply nested object. I suppose I should add one, because that could also blow the limit too.
The point of this message is to see if anyone thinks 2000 is unreasonable. It could probably be raised, but I'm not going to try it since I don't have access to a Windows box. Testing this remotely sucks.
n
- Previous message: [Python-Dev] marshal and ssize_t (PEP 353)
- Next message: [Python-Dev] recursion limit in marshal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]