diff options
author | Damien George <damien.p.george@gmail.com> | 2015-02-02 21:52:19 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-02-02 21:52:19 +0000 |
commit | 5f64dc55d89444fcc3a5903d658eb327e1b6ef74 (patch) | |
tree | 94effbc0fd58bc50ba682dc99d0f83102c1446c7 /extmod/modujson.c | |
parent | e8b877be6018893f1250c87424c3886f115b0051 (diff) | |
download | micropython-5f64dc55d89444fcc3a5903d658eb327e1b6ef74.tar.gz micropython-5f64dc55d89444fcc3a5903d658eb327e1b6ef74.zip |
extmod: Make ujson.loads raise exception if given empty string.
Addresses issue #1097.
Diffstat (limited to 'extmod/modujson.c')
-rw-r--r-- | extmod/modujson.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/extmod/modujson.c b/extmod/modujson.c index a7b889676a..d1d103237e 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -239,7 +239,8 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) { // unexpected chars goto fail; } - if (stack.len != 0) { + if (stack_top == MP_OBJ_NULL || stack.len != 0) { + // not exactly 1 object goto fail; } vstr_clear(&vstr); |