This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: wrong handling of character buffers in stringobject
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: georg.brandl, nnorwitz
Priority: critical Keywords:

Created on 2006-07-01 09:41 by georg.brandl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg29007 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-07-01 09:41
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.
msg29008 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-07-30 07:03
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.
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43592
2006-07-01 09:41:30georg.brandlcreate