Skip to content

Commit

Permalink
libtomlc99: fix segfaulting test
Browse files Browse the repository at this point in the history
Pulled from cktan/tomlc99@01ecb88d1.

This fixes cktan/tomlc99#3: bad input file causes segfault.
  • Loading branch information
cktan authored and garlick committed Nov 18, 2017
1 parent d5385e8 commit b42ed9c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libtomlc99/toml.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,10 @@ static void parse_select(context_t* ctx)
/* [[x.y.z]] -> create z = [] in x.y */
toml_array_t* arr = create_keyarray_in_table(ctx, ctx->curtab, z,
1 /*skip_if_exist*/);
if (!arr) {
e_syntax_error(ctx, z.lineno, "key exists");
return;
}
if (arr->kind == 0) arr->kind = 't';
if (arr->kind != 't') {
e_syntax_error(ctx, z.lineno, "array mismatch");
Expand Down

0 comments on commit b42ed9c

Please sign in to comment.