Skip to content

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

Merged
serhiy-storchaka merged 3 commits into
python:2.7from
serhiy-storchaka:backport-fdb5a50-2.7
Dec 4, 2018
Merged

[2.7] bpo-25862: Fix several bugs in the _io module. (GH-8026)#8033
serhiy-storchaka merged 3 commits into
python:2.7from
serhiy-storchaka:backport-fdb5a50-2.7

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

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
Comment thread Modules/_io/textio.c Outdated
Py_DECREF(next_input);
goto fail;
}
PyObject *snapshot = Py_BuildValue("NN", dec_flags, next_input);

Copy link
Copy Markdown
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