mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
json: Fix latent parser aborts at end of input
json-parser.c carefully reports end of input like this:
token = parser_context_pop_token(ctxt);
if (token == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
Except parser_context_pop_token() can't return null, it fails its
assertion instead. Same for parser_context_peek_token(). Broken in
commit 65c0f1e955, and faithfully preserved in commit 95385fe9ac.
Only a latent bug, because the streamer throws away any input that
could trigger it.
Drop the assertions, so we can fix the streamer in the next commit.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180823164025.12553-45-armbru@redhat.com>
This commit is contained in:
parent
2a4794ba14
commit
e06d008ac8
1 changed files with 0 additions and 2 deletions
|
|
@ -226,14 +226,12 @@ out:
|
||||||
static JSONToken *parser_context_pop_token(JSONParserContext *ctxt)
|
static JSONToken *parser_context_pop_token(JSONParserContext *ctxt)
|
||||||
{
|
{
|
||||||
g_free(ctxt->current);
|
g_free(ctxt->current);
|
||||||
assert(!g_queue_is_empty(ctxt->buf));
|
|
||||||
ctxt->current = g_queue_pop_head(ctxt->buf);
|
ctxt->current = g_queue_pop_head(ctxt->buf);
|
||||||
return ctxt->current;
|
return ctxt->current;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSONToken *parser_context_peek_token(JSONParserContext *ctxt)
|
static JSONToken *parser_context_peek_token(JSONParserContext *ctxt)
|
||||||
{
|
{
|
||||||
assert(!g_queue_is_empty(ctxt->buf));
|
|
||||||
return g_queue_peek_head(ctxt->buf);
|
return g_queue_peek_head(ctxt->buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue