Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix possible leak of return of PySequence_GetItem. #13333

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 1 commit into from
Feb 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 src/_path_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject *
return NULL;
}
codes[i] = PyBytes_AsString(item);
Py_DECREF(item);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just change the PyArg_ParseTuple call to use a (yyyyy) format for parsing the codes argument instead?

Copy link
Member

Choose a reason for hiding this comment

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

I am 50/50 on that. It lets python do more of the work, but is also a bigger change.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think all of our callers pass the right length lists, but as I'm targeting 3.0.3 with this, I'm not sure if it's quite as safe to be backporting that version.

Copy link
Contributor

Choose a reason for hiding this comment

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

But we already error out a few lines above if the length is not 5.
Anyways I don't want to insist too much on this, if you don't want to make the bigger change that's fine with me too.

if (codes[i] == NULL) {
return NULL;
}
Expand Down
1 change: 1 addition & 0 deletions 1 src/py_adaptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class PathGenerator
throw py::exception();
}
if (!convert_path(item, &path)) {
Py_DECREF(item);
throw py::exception();
}
Py_DECREF(item);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.