[New-bugs-announce] [issue7019] unmarshaling of artificial strings can produce funny longs.

Carl Friedrich Bolz report at bugs.python.org
Tue Sep 29 16:35:59 CEST 2009


New submission from Carl Friedrich Bolz <cfbolz at gmx.de>:

When unmarshalling a hand-written string it is possible to break the
invariants of longs:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = marshal.loads('l\x02\x00\x00\x00\x00\x00\x00\x00')
>>> print x
00000
>>> x == 0
False
>>> bool(x)
True
>>> x + 1
1L

I would expect this to raise an error instead.

----------
components: Interpreter Core
messages: 93295
nosy: cfbolz
severity: normal
status: open
title: unmarshaling of artificial strings can produce funny longs.
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7019>
_______________________________________


More information about the New-bugs-announce mailing list