| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
|
||
| if(!PySequence_Check(file_actions_obj) | !PySequence_Size(file_actions_obj)) { | ||
| PyErr_SetString(PyExc_TypeError,"Each file_action element must be a non empty sequence"); | ||
| if (file_actions_obj == NULL) { |
There was a problem hiding this comment.
Is it possible?
Sorry, something went wrong.
| if (file_actions_obj == NULL) { | ||
| goto exit; | ||
| } | ||
| file_actions_obj = PySequence_Fast(file_actions_obj, "Each file_action element must be a non-empty sequence"); |
There was a problem hiding this comment.
Would be nice to wrap this long line.
Sorry, something went wrong.
|
|
||
| long open_fd = PyLong_AsLong(PySequence_GetItem(file_actions_obj, 1)); | ||
| long open_fd = PyLong_AsLong(PySequence_Fast_GET_ITEM(file_actions_obj, 1)); | ||
| if(PyErr_Occurred()) { |
There was a problem hiding this comment.
While you are here, could you please make the source conforming PEP 7: Add spaces after "if" and "switch", wrap long lines?
Sorry, something went wrong.
| } | ||
|
|
||
| long open_fd = PyLong_AsLong(PySequence_GetItem(file_actions_obj, 1)); | ||
| long open_fd = PyLong_AsLong(PySequence_Fast_GET_ITEM(file_actions_obj, 1)); |
There was a problem hiding this comment.
PyLong_AsLong() can call arbitrary code. If file_actions is a list, the size of file_actions_obj can be changed after this, and the following PySequence_Fast_GET_ITEM() could read past the end of the list.
I would require file_actions to be a tuple and use PyArg_ParseTuple() for parsing it.
Sorry, something went wrong.
|
I have added more comments in #5109 because it is hard to add comment to the code not changed in a PR. |
Sorry, something went wrong.
|
@serhiy-storchaka Would you mind to take this over? I would like to see this fixed before 3.7.0 final, but don't know when I'll be able to get back to it. |
Sorry, something went wrong.
|
I have opened #6331 trying to address al the issues at once. |
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
https://bugs.python.org/issue33191