[Patches] [ python-Patches-873224 ] Marshal clean-up

SourceForge.net noreply at sourceforge.net
Thu Jan 8 14:00:39 EST 2004


Patches item #873224, was opened at 2004-01-08 18:29
Message generated for change (Comment added) made by arigo
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=873224&group_id=5470

Category: Core (C code)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 2
Submitted By: Armin Rigo (arigo)
>Assigned to: Nobody/Anonymous (nobody)
Summary: Marshal clean-up

Initial Comment:
Reading random bytes with the marshal module can segfault the interpreter.  Moreover, reading a truncated .pyc file can also successfully return a (corrupted) object instead of raising an error.

Please review the attached patch if you consider this to be worth fixing.

The patch also fixes a minor bug in import.c, which would sometimes write incomplete .pyc files in case of write error (and hence the truncated .pyc file problems could actually show up, in theory).

----------------------------------------------------------------------

>Comment By: Armin Rigo (arigo)
Date: 2004-01-08 19:00

Message:
Logged In: YES 
user_id=4771

Test cases:

>>> marshal.loads('0') -> SystemError
>>> marshal.loads('f') -> segfault

>>> marshal.dumps(5L)
'l\x01\x00\x00\x00\x05\x00'
>>> marshal.loads(_[:-1])
65285L


----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2004-01-08 18:55

Message:
Logged In: YES 
user_id=6656

This patch results from my comments on IRC, so I'll take a look at it.

Needs testcases!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=873224&group_id=5470



More information about the Patches mailing list