From f8996cb202062a00aec1c599efe748cfe2c5521a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 5 Oct 2023 11:33:06 -0700 Subject: [PATCH] Fix json tests by checking for zero read from stream --- extmod/modujson.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extmod/modujson.c b/extmod/modujson.c index 9f454f1fc3..956e93991f 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -176,6 +176,9 @@ STATIC mp_uint_t ujson_python_readinto(mp_obj_t obj, void *buf, mp_uint_t size, } s->start = 0; s->end = mp_obj_get_int(ret); + if (s->end == 0) { + return 0; + } } *((uint8_t *)buf) = ((uint8_t *)s->bytearray_obj.items)[s->start];