From 862518ed17ca9d90141d7bb71d31120aa553a152 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 20 Jul 2024 21:52:46 +0100 Subject: [PATCH] Free: Handle invalid schema with binary type inside mapping --- src/free.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/free.c b/src/free.c index 266cd7b..f5d2248 100644 --- a/src/free.c +++ b/src/free.c @@ -62,6 +62,12 @@ static void cyaml__free_sequence( const cyaml_schema_value_t *schema = sequence_schema->sequence.entry; uint32_t data_size = schema->data_size; + if (schema->type == CYAML_BINARY) { + cyaml__log(cfg, CYAML_LOG_ERROR, + "Free: Invalid schema; binary outside mapping\n"); + return; + } + cyaml__log(cfg, CYAML_LOG_DEBUG, "Free: Freeing sequence with count: %u\n", count);