Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAPI: inspect token unless the type_stack is empty #3261

Merged
merged 2 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Units/parser-openapi.r/crash-test.d/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is a crash test.
The code is derived from puppet/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/data/bad.yaml.

REPO=https://github.com/puppetlabs/puppet.git
ALIGNMENT=6.2.0
LANGUAGES=Ruby,PuppetManifest
1 change: 1 addition & 0 deletions Units/parser-openapi.r/crash-test.d/input.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{x:
7 changes: 5 additions & 2 deletions parsers/openapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,12 @@ static void openapiPlayStateMachine (struct sOpenAPISubparser *openapi,
switch (openapi->play_detection_state)
{
case DSTAT_LAST_KEY:
openapi->type_stack->key = parseKey(token);
TRACE_PRINT(" key: %s\n", (char*)token->data.scalar.value);
handleKey (openapi, token);
if (openapi->type_stack)
{
openapi->type_stack->key = parseKey(token);
handleKey (openapi, token);
}
break;
case DSTAT_LAST_VALUE:
TRACE_PRINT(" value: %s\n", (char*)token->data.scalar.value);
Expand Down