Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 38536:175cbdf9a5fb legacy-trunk
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
| author | Armin Rigo <arigo@tunes.org> |
|---|---|
| date | Thu, 01 Jun 2006 13:19:12 +0000 |
| parents | ca657e0bd09c |
| children | 42808526511c |
line wrap: on
line diff
--- a/Python/ceval.c Thu Jun 01 13:00:49 2006 +0000 +++ b/Python/ceval.c Thu Jun 01 13:19:12 2006 +0000 @@ -1855,15 +1855,26 @@ 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);
