diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2020-04-23 01:10:30 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-04-27 23:53:17 +1000 |
commit | 57fce3bdb203e9701dbd81ee108189898e19911b (patch) | |
tree | bffc02c12f2c5c78e082bec83e903c793cea778b /py/obj.h | |
parent | 347c8917dc8d2785fdbd8c9a0f554219e6216647 (diff) |
py/objdict: Fix popitem for ordered dicts.
The popitem method wasn't implemented for ordered dicts and would result in
an invalid state.
Fixes issue #5956.
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -26,6 +26,8 @@ #ifndef MICROPY_INCLUDED_PY_OBJ_H #define MICROPY_INCLUDED_PY_OBJ_H +#include <assert.h> + #include "py/mpconfig.h" #include "py/misc.h" #include "py/qstr.h" @@ -423,6 +425,7 @@ typedef enum _mp_map_lookup_kind_t { extern const mp_map_t mp_const_empty_map; static inline bool mp_map_slot_is_filled(const mp_map_t *map, size_t pos) { + assert(pos < map->alloc); return (map)->table[pos].key != MP_OBJ_NULL && (map)->table[pos].key != MP_OBJ_SENTINEL; } |