From bf4bb9fcc148df2316fbc968586bd9ad265f5510 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 23 Sep 2024 09:35:00 +0200 Subject: [PATCH] json-pod: return errors from spa_json_next() Instead of silently ignoring the error and continuing. See #4313 --- spa/include/spa/utils/json-pod.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spa/include/spa/utils/json-pod.h b/spa/include/spa/utils/json-pod.h index bbd0ec7a9..0c9bdb8af 100644 --- a/spa/include/spa/utils/json-pod.h +++ b/spa/include/spa/utils/json-pod.h @@ -54,6 +54,8 @@ static inline int spa_json_to_pod_part(struct spa_pod_builder *b, uint32_t flags if ((res = spa_json_to_pod_part(b, flags, id, pi, &it[0], v, l)) < 0) return res; } + if (l < 0) + return l; spa_pod_builder_pop(b, &f[0]); } else if (spa_json_is_array(value, len)) { @@ -67,6 +69,8 @@ static inline int spa_json_to_pod_part(struct spa_pod_builder *b, uint32_t flags while ((l = spa_json_next(&it[0], &v)) > 0) if ((res = spa_json_to_pod_part(b, flags, id, info, &it[0], v, l)) < 0) return res; + if (l < 0) + return l; spa_pod_builder_pop(b, &f[0]); } else if (spa_json_is_float(value, len)) {