From 4fabfb5063265f051be7c60cc44a70b37682e1df Mon Sep 17 00:00:00 2001 From: Nicolas Chataing Date: Mon, 13 Feb 2023 16:04:31 +0100 Subject: [PATCH] fix(pretty): advance to the end of the iterator if recursion limit was hit --- src/cborpretty.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cborpretty.c b/src/cborpretty.c index 49d3cae7..763d822f 100644 --- a/src/cborpretty.c +++ b/src/cborpretty.c @@ -314,7 +314,10 @@ static CborError container_to_pretty(CborStreamFunction stream, void *out, CborV if (!recursionsLeft) { printRecursionLimit(stream, out); - return err; /* do allow the dumping to continue */ + while (!cbor_value_at_end(it) && !err) { + err = cbor_value_advance(it); + } + return err; /* do allow the dumping to continue (if the advance was OK) */ } while (!cbor_value_at_end(it) && !err) {