New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on test_issue_1395_5 with Python 2.7 and VS2010 #57670
Comments
I am trying to get Python working when compiled with Visual Studio 2010 (cf bpo-13210). When running the tests with the python 2.7 branch compiled with VS2010, the "test_issue_1395_5" in test_io.py will cause Python to eat the whole memory within a few seconds and make the server completely unresponsive. |
The problem is in CTextIOWrapperTest.test_issue1395_5
So the problem happens when calling in textio.c:
{{{
PyObject *decoded = PyObject_CallMethod(
self->decoder, "decode", "s#", input, 1);
}}} self->decoder is of type "_io.IncrementalNewlineDecoder" and input is "BBB". This will result in PyString_FromStringAndSize being called with size = 4294967297, which will cause the server to fall. |
What if you replace: PyObject *decoded = PyObject_CallMethod(
self->decoder, "decode", "s#", input, 1); with: PyObject *decoded = PyObject_CallMethod(
self->decoder, "decode", "s#", input, (Py_ssize_t) 1); |
Thanks Antoine! It solved the issue. I will check soon with Python trunk to see if the same thing applies. |
I've identified a few other cases where a '#' format is passed a numeric literal: Python/codecs.c:514: return Py_BuildValue("(u#n)", &end, 0, end); |
Can we fix this easy issue before 2.7.4 release? |
Ageed, it's probably easy enough. |
This patch should work for 2.7 branch |
New changeset 826233404be8 by Serhiy Storchaka in branch '3.3': New changeset 6c9d49b8e3ec by Serhiy Storchaka in branch 'default': New changeset 5e679ef2a55c by Serhiy Storchaka in branch '2.7': |
Thank you for the report Sébastien. Thank you for the patch Yogesh. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: