summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2006-06-01 13:19:12 (GMT)
committerArmin Rigo <arigo@tunes.org>2006-06-01 13:19:12 (GMT)
commit35f6d36951766c8ca7a88642415e76a603751878 (patch)
treed75f5ffac6c764c9485f6134f4d3d2c3fc1081a1 /Python/ceval.c
parente08940ef6c93e89c5a9163e8e433cb53a894dd56 (diff)
downloadcpython-35f6d36951766c8ca7a88642415e76a603751878.zip
cpython-35f6d36951766c8ca7a88642415e76a603751878.tar.gz
cpython-35f6d36951766c8ca7a88642415e76a603751878.tar.bz2
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 803815e..4d20431 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1855,15 +1855,26 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
long hash = ((PyStringObject *)w)->ob_shash;
if (hash != -1) {
PyDictObject *d;
+ PyDictEntry *e;
d = (PyDictObject *)(f->f_globals);
- x = d->ma_lookup(d, w, hash)->me_value;
+ e = d->ma_lookup(d, w, hash);
+ if (e == NULL) {
+ x = NULL;
+ break;
+ }
+ x = e->me_value;
if (x != NULL) {
Py_INCREF(x);
PUSH(x);
continue;
}
d = (PyDictObject *)(f->f_builtins);
- x = d->ma_lookup(d, w, hash)->me_value;
+ e = d->ma_lookup(d, w, hash);
+ if (e == NULL) {
+ x = NULL;
+ break;
+ }
+ x = e->me_value;
if (x != NULL) {
Py_INCREF(x);
PUSH(x);