[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

/ cpython Public

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

bpo-30070: Fixed leaks and crashes in errors handling in the parser module. #1131

Merged

Conversation

Copy link
Member

serhiy-storchaka commented Apr 14, 2017

No description provided.

serhiy-storchaka added type-bug needs backport to 2.7 labels Apr 14, 2017
serhiy-storchaka requested a review from benjaminp Apr 14, 2017
Copy link

mention-bot commented Apr 14, 2017

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @freddrake, @loewis and @benjaminp to be potential reviewers.

Copy link
Contributor

louisom commented Apr 17, 2017

@serhiy-storchaka May I ask a question? How did you found this bug, is via valgrind or something else? thanks.

Copy link
Member Author

serhiy-storchaka commented Apr 17, 2017

Just by reading a code. I searched unchecked usages of PyObject_Size()/PySequence_Size()/PyMapping_Size() for bpo-30061 and after finding few suspicious cases in parsermodule.c analyzed other code in that file.

Copy link
Contributor

louisom left a comment

A small question about ref

}
else {
/* The tuple is illegal -- if the number is neither TERMINAL nor
* NONTERMINAL, we can't use it. Not sure the implementation
* allows this condition, but the API doesn't preclude it.
*/
PyObject *err = Py_BuildValue("os", tuple,
PyObject *err = Py_BuildValue("Os", tuple,
"Illegal component tuple.");
PyErr_SetObject(parser_error, err);
Py_XDECREF(err);
Copy link
Contributor

louisom Apr 17, 2017

Choose a reason for hiding this comment

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

Should tuple need Py_DECREF too? like what you done at line 950

Copy link
Member Author

serhiy-storchaka Apr 17, 2017

Choose a reason for hiding this comment

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

No. tuple is a borrowed reference here (it's a parameter of build_node_tree()).

Copy link
Contributor

louisom Apr 17, 2017

Choose a reason for hiding this comment

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

ah, I see. didn't notice this. Thanks for your explain!

serhiy-storchaka merged commit a79f4c2 into python:master Apr 19, 2017
3 checks passed
serhiy-storchaka deleted the parsermodule-errors-handling branch Apr 19, 2017
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Apr 19, 2017
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Apr 19, 2017
serhiy-storchaka added a commit that referenced this issue Apr 19, 2017
serhiy-storchaka added a commit that referenced this issue Apr 19, 2017
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Apr 19, 2017
…the parser module. (pythonGH-1131). (pythonGH-1185)

(cherry picked from commit a79f4c2).
(cherry picked from commit 952a05e)
serhiy-storchaka added a commit that referenced this issue Apr 19, 2017
…the parser module. (GH-1131). (GH-1185) (#1189)

(cherry picked from commit a79f4c2).
(cherry picked from commit 952a05e)
zhangyangyu pushed a commit to zhangyangyu/cpython that referenced this issue May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA signed type-bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants