[Python-Dev] PEP 298

Guido van Rossum guido@python.org
Fri, 13 Dec 2002 10:19:56 -0500


> > Well... Note that you are currently living dangerously if you're using
> > an s# format and access that buffer again after a
> > Py_BEGIN_ALLOW_THREADS. If the object passed from Python was a mutable
> > object with a buffer interface there's a chance that another thread
> > has moved the underlying data.
> 
> It can even by the same thread, executing an innocent Py_DECREF()
> can execute arbitrary Python code. Thinking of it, it's not clear
> what you are allowed to do after PyArg_Parse() if you still need
> the 'parsed pointers'.
> 
> And that's the main point of the PEP: the 'old' buffer interface
> is nearly useless if you want too be safe.

Except that we can't force everyone to change at once, so we're stuck
with this...

Can you find an actual case where this could be used to cause a
segfault?

--Guido van Rossum (home page: http://www.python.org/~guido/)