diff options
author | Christian Heimes <christian@python.org> | 2016-09-08 22:20:13 (GMT) |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2016-09-08 22:20:13 (GMT) |
commit | 884332b45a436a90c5a36c3d6288566fb7ce3456 (patch) | |
tree | 923064fabcc0a4d388a388e3c84857bfe9bf9fec /Objects | |
parent | 7a5457b6878db61910c81017d10579edb7c91512 (diff) | |
download | cpython-884332b45a436a90c5a36c3d6288566fb7ce3456.zip cpython-884332b45a436a90c5a36c3d6288566fb7ce3456.tar.gz cpython-884332b45a436a90c5a36c3d6288566fb7ce3456.tar.bz2 |
Add NULL check for gen->gi_code in gen_send_ex()
_PyGen_Finalize() checks that gen->gi_code is not NULL before it
accesses the flags of the code object. This means that the flag
could be NULL.
It passes down the generatore to gen_close() and gen_send_ex().
gen_send_ex() did not check for gen->gi_code != NULL.
CID 1297900
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/genobject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index 562d41d..19d388e 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -167,7 +167,7 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing) /* Check for __future__ generator_stop and conditionally turn * a leaking StopIteration into RuntimeError (with its cause * set appropriately). */ - if (((PyCodeObject *)gen->gi_code)->co_flags & + if (gen->gi_code != NULL && ((PyCodeObject *)gen->gi_code)->co_flags & (CO_FUTURE_GENERATOR_STOP | CO_COROUTINE | CO_ITERABLE_COROUTINE)) { PyObject *exc, *val, *val2, *tb; |