diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-02-02 16:15:31 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-02-02 16:15:31 +0000 |
commit | cd6739b32c3fbc094c41625a80c922558aec0fdd (patch) | |
tree | 2d8ffcf311f66287e131f4d4a3e1361b75cee017 /src | |
parent | 611b068491afcc16cce47fe6fedbfcdee5e67ca3 (diff) | |
download | rspamd-cd6739b32c3fbc094c41625a80c922558aec0fdd.tar.gz rspamd-cd6739b32c3fbc094c41625a80c922558aec0fdd.zip |
Fix with libucl.
Diffstat (limited to 'src')
-rw-r--r-- | src/ucl/src/ucl_parser.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ucl/src/ucl_parser.c b/src/ucl/src/ucl_parser.c index f18a9b671..b0662aeb4 100644 --- a/src/ucl/src/ucl_parser.c +++ b/src/ucl/src/ucl_parser.c @@ -1625,6 +1625,14 @@ ucl_state_machine (struct ucl_parser *parser) parser->state = UCL_STATE_AFTER_VALUE; continue; } + if (parser->stack == NULL) { + /* No objects are on stack, but we want to parse a key */ + ucl_set_err (chunk, UCL_ESYNTAX, "top object is finished but the parser " + "expects a key", &parser->err); + parser->prev_state = parser->state; + parser->state = UCL_STATE_ERROR; + return false; + } if (!ucl_parse_key (parser, chunk, &next_key, &end_of_object)) { parser->prev_state = parser->state; parser->state = UCL_STATE_ERROR; @@ -1688,7 +1696,8 @@ ucl_state_machine (struct ucl_parser *parser) /* We got macro name */ HASH_FIND (hh, parser->macroes, c, (p - c), macro); if (macro == NULL) { - ucl_create_err (&parser->err, "error on line %d at column %d: unknown macro: '%.*s', character: '%c'", + ucl_create_err (&parser->err, "error on line %d at column %d: " + "unknown macro: '%.*s', character: '%c'", chunk->line, chunk->column, (int)(p - c), c, *chunk->pos); parser->state = UCL_STATE_ERROR; return false; @@ -1735,7 +1744,7 @@ ucl_state_machine (struct ucl_parser *parser) break; default: /* TODO: add all states */ - ucl_set_err (chunk, UCL_EMACRO, "internal error: parser is in an unknown state", &parser->err); + ucl_set_err (chunk, UCL_EINTERNAL, "internal error: parser is in an unknown state", &parser->err); parser->state = UCL_STATE_ERROR; return false; } |