Skip to content

[2.7] bpo-25862: Fix several bugs in the _io module. (GH-8026) #8033

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

Merged
merged 3 commits into from
Dec 4, 2018

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jun 30, 2018

They can be exposed when some C API calls fail due to lack of
memory.

  • Failed Py_BuildValue() could cause an assertion error in the
    following TextIOWrapper.tell().
  • input_chunk could be decrefed twice in TextIOWrapper.seek()
    after failed Py_BuildValue().
  • initvalue could leak in StringIO.getstate() after failed
    PyDict_Copy().
    (cherry picked from commit fdb5a50)

https://bugs.python.org/issue25862

They can be exposed when some C API calls fail due to lack of
memory.

* Failed Py_BuildValue() could cause an assertion error in the
  following TextIOWrapper.tell().
* input_chunk could be decrefed twice in TextIOWrapper.seek()
  after failed Py_BuildValue().
* initvalue could leak in StringIO.__getstate__() after failed
  PyDict_Copy()..
(cherry picked from commit fdb5a50)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error skip news labels Jun 30, 2018
@bedevere-bot bedevere-bot added the type-bug An unexpected behavior, bug, or error label Jun 30, 2018
@@ -1477,8 +1477,13 @@ textiowrapper_read_chunk(textio *self)
Py_DECREF(next_input);
goto fail;
}
PyObject *snapshot = Py_BuildValue("NN", dec_flags, next_input);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaring snapshot at the top of the block will likely fix the AppVeyor build.

@serhiy-storchaka serhiy-storchaka merged commit eab421b into python:2.7 Dec 4, 2018
@serhiy-storchaka serhiy-storchaka deleted the backport-fdb5a50-2.7 branch December 4, 2018 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants