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

bpo-31337 Close a minor NULL dereference opportunity#3282

Closed
warsaw wants to merge 5 commits into
python:masterpython/cpython:masterfrom
warsaw:compile-null-ptrwarsaw/cpython:compile-null-ptrCopy head branch name to clipboard
Closed

bpo-31337 Close a minor NULL dereference opportunity#3282
warsaw wants to merge 5 commits into
python:masterpython/cpython:masterfrom
warsaw:compile-null-ptrwarsaw/cpython:compile-null-ptrCopy head branch name to clipboard

Conversation

@warsaw

@warsaw warsaw commented Sep 4, 2017

Copy link
Copy Markdown
Member

@warsaw warsaw changed the title Close a minor NULL dereference opportunity bpo-31337 Close a minor NULL dereference opportunity Sep 4, 2017
Comment thread Python/compile.c
key = get_const_value((expr_ty)asdl_seq_GET(e->v.Dict.keys, i));
if (key == NULL) {
Py_DECREF(keys);
return 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In this case an error is returned, but no exception is set. This looks like a bug to me. We have fixed a number of similar bugs recent times (thanks to Victor's runtime checks).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@serhiy-storchaka Thanks! Where would I see an example of Victor's runtime checks? I didn't notice anything in local tests.

What exception do you think we should raise? MemoryError, RuntimeError or something else?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

PyErr_BadInternalCall() is the most obvious.

@serhiy-storchaka

serhiy-storchaka commented Sep 5, 2017 via email

Copy link
Copy Markdown
Member

@warsaw

warsaw commented Sep 5, 2017

Copy link
Copy Markdown
Member Author

@serhiy-storchaka Oh, I see what your reference to "Victor's runtime checks" are. Yes, I knew about the !PyErr_Occurred() check, but not the reference.

I don't agree that this is obviously dead code. You have to reason about the control flow, and assume that -DNDEBUG was not given, and that nothing changes to subtle break the assumptions in this code. With additional feedback, I am however willing to forego applying this in favor of a more comprehensive fix for bpo-31338.

@warsaw

warsaw commented Sep 6, 2017

Copy link
Copy Markdown
Member Author

Closing this in favor of bpo-33138

@warsaw warsaw closed this Sep 6, 2017
@warsaw warsaw deleted the compile-null-ptr branch September 6, 2017 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.