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

SourceForge.net noreply at sourceforge.net
Fri Mar 26 08:39:01 EST 2004


Patches item #873224, was opened at 2004-01-08 19:29
Message generated for change (Comment added) made by loewis
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: Accepted
Priority: 2
Submitted By: Armin Rigo (arigo)
>Assigned to: Armin Rigo (arigo)
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: Martin v. Löwis (loewis)
Date: 2004-03-26 14:38

Message:
Logged In: YES 
user_id=21627

The patch is fine, please apply.

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

Comment By: Armin Rigo (arigo)
Date: 2004-01-08 20: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 19: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