From 5f64dc55d89444fcc3a5903d658eb327e1b6ef74 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 2 Feb 2015 21:52:19 +0000 Subject: extmod: Make ujson.loads raise exception if given empty string. Addresses issue #1097. --- extmod/modujson.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'extmod') diff --git a/extmod/modujson.c b/extmod/modujson.c index a7b889676..d1d103237 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); -- cgit v1.2.3