Skip to content

Commit

Permalink
Merge pull request #306 from vstakhov/vstakhov-messagepack-fix-ext
Browse files Browse the repository at this point in the history
Fix messagepack EXT parsing
  • Loading branch information
vstakhov authored Apr 25, 2024
2 parents 084de92 + 1e409ae commit 5c58d0d
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/ucl_msgpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1146,9 +1146,14 @@ ucl_msgpack_consume (struct ucl_parser *parser)


/* Insert value to the container and check if we have finished array */
if (!ucl_msgpack_insert_object (parser, NULL, 0,
if (parser->cur_obj) {
if (!ucl_msgpack_insert_object(parser, NULL, 0,
parser->cur_obj)) {
return false;
return false;
}
}
else {
/* We have parsed ext, ignore it */
}

if (ucl_msgpack_is_container_finished (container)) {
Expand Down Expand Up @@ -1207,10 +1212,12 @@ ucl_msgpack_consume (struct ucl_parser *parser)

assert (key != NULL && keylen > 0);

if (!ucl_msgpack_insert_object (parser, key, keylen,
if (parser->cur_obj) {
if (!ucl_msgpack_insert_object(parser, key, keylen,
parser->cur_obj)) {

return false;
return false;
}
}

key = NULL;
Expand Down Expand Up @@ -1299,9 +1306,11 @@ ucl_msgpack_consume (struct ucl_parser *parser)


/* Insert value to the container and check if we have finished array */
if (!ucl_msgpack_insert_object (parser, NULL, 0,
if (parser->cur_obj) {
if (!ucl_msgpack_insert_object(parser, NULL, 0,
parser->cur_obj)) {
return false;
return false;
}
}
break;
case finish_array_value:
Expand Down Expand Up @@ -1634,5 +1643,7 @@ ucl_msgpack_parse_ignore (struct ucl_parser *parser,
return -1;
}

parser->cur_obj = NULL;

return len;
}

0 comments on commit 5c58d0d

Please sign in to comment.