[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-bugs-list
Subject:    [ python-Bugs-1075356 ] exceeding obscure weakproxy bug
From:       noreply () sourceforge ! net (SourceForge ! net)
Date:       2004-11-29 17:10:37
Message-ID: E1CYo6l-0006R3-I9 () sc8-sf-web2 ! sourceforge ! net
[Download RAW message or body]

Bugs item #1075356, was opened at 2004-11-29 16:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1075356&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 3
Submitted By: Michael Hudson (mwh)
Assigned to: Nobody/Anonymous (nobody)
Summary: exceeding obscure weakproxy bug

Initial Comment:
Broadly speaking, this line (488 in today's CVS) in
Python/weakref.c isn't right:

WRAP_UNARY(proxy_int, PyNumber_Int)

because PyNumber_Int will convert from a string
argument.  You can "exploit" this like so:

class U(unicode): pass

u = U("1")
try:
    range(u)
except TypeError:
    print "raised, good"
else:
    print "didn't raise, bad"
import _weakref

try:
    range(_weakref.proxy(u))
except TypeError:
    print "raised, good"
else:
    print "didn't raise, bad"

(prints

raised, good
didn't raise, bad

for me).  I think the fix is PyNumber_Int ->
PyInt_AsLong, but haven't checked that.

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

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic