Skip to content

Commit

Permalink
Merge pull request #294 from vstakhov/vstakhov-fix-fuzz
Browse files Browse the repository at this point in the history
Fix issues with the include error propagation
  • Loading branch information
vstakhov committed Apr 20, 2024
2 parents 51c5e2f + f8f5c0d commit a5c45e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ucl_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/ucl_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a5c45e8

Please sign in to comment.