Skip to content

Parsing context does not change when finding block directives with wrong number of arguments #99

Open
@dareste

Description

@dareste

Describe the bug

When the parser finds a block with a wrong number of arguments, the error is collected but the context does not change. This means we continue to ingest tokens and analyze statements under a wrong context.

Also, if the parent context is NGX_MAIN_CONF, the next closing bracket token will be interpreted as the end of file, and parsing will stop.

To reproduce

Analyze the following configuration:

user nginx;
worker_processes auto;
events  {
    worker_connections  1024;
}
http 123 {
   [http directives]
}
[more directives]
...

this will produce:

  • One error for the http directive (wrong number of parameters).
  • Errors for all the [http directives] (wrong context).
  • Premature end of parsing before [more directives] are consumed.

Expected behavior

A block directive with a wrong number of arguments (and probably other types of errors as well) should trigger a change of context in the analyze function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions