From 0d78b7d7da96dbcec4bbbd3d4fb2d6369d95609d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 20 Apr 2024 12:29:51 +0100 Subject: [PATCH 1/2] Do not try to continue including if we are in the error state Issue: #288 --- src/ucl_util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ucl_util.c b/src/ucl_util.c index 74bbe4c..8f97c20 100644 --- a/src/ucl_util.c +++ b/src/ucl_util.c @@ -1100,6 +1100,11 @@ ucl_include_file_single (const unsigned char *data, size_t len, ucl_hash_t *container = NULL; struct ucl_stack *st = NULL; + if (parser->state == UCL_STATE_ERROR) { + /* Return immediately if we are in the error state... */ + return false; + } + snprintf (filebuf, sizeof (filebuf), "%.*s", (int)len, data); if (ucl_realpath (filebuf, realbuf) == NULL) { if (params->soft_fail) { From f8f5c0d4fcf6ed749af1bbff084fdbf507e232a8 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 20 Apr 2024 12:35:18 +0100 Subject: [PATCH 2/2] Allow propagating of the error state --- src/ucl_parser.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ucl_parser.c b/src/ucl_parser.c index e70de4d..bbdfcc2 100644 --- a/src/ucl_parser.c +++ b/src/ucl_parser.c @@ -2691,6 +2691,9 @@ ucl_state_machine (struct ucl_parser *parser) return false; } break; + case UCL_STATE_ERROR: + /* Already in the error state */ + return false; default: ucl_set_err (parser, UCL_EINTERNAL, "internal error: parser is in an unknown state", &parser->err);