[ python-Bugs-1515471 ] wrong handling of character buffers in stringobject

SourceForge.net noreply at sourceforge.net
Sun Jul 30 09:03:17 CEST 2006


Bugs item #1515471, was opened at 2006-07-01 02:41
Message generated for change (Settings changed) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1515471&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 9
Submitted By: Georg Brandl (gbrandl)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: wrong handling of character buffers in stringobject

Initial Comment:
stringobject.c:

In string_replace, there is

	if (PyString_Check(from)) {
	  /* Can this be made a '!check' after the Unicode
check? */
	}
#ifdef Py_USING_UNICODE
	if (PyUnicode_Check(from))
		return PyUnicode_Replace((PyObject *)self,
					 from, to, count);
#endif
	else if (PyObject_AsCharBuffer(from, &tmp_s, &tmp_len))
		return NULL;

[the same check with "to"]

	return (PyObject *)replace((PyStringObject *) self,
				   (PyStringObject *) from,
				   (PyStringObject *) to, count);

This is not correct if from or to isn't a string
object, but a char buffer compatible object.


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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-07-30 00:03

Message:
Logged In: YES 
user_id=33168

Committed revision 50970.

Georg, let me know if you find any more issues.  I didn't
look for other places where a buffer wasn't handled
properly.  Thanks.

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

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


More information about the Python-bugs-list mailing list