提交 c1990ebf 编写于 作者: M Michael Roth 提交者: Anthony Liguori

json-parser: add handling for NULL token list

Currently a NULL token list will crash the parser, instead we have it
pass back a NULL QObject.
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 5e2dafeb
......@@ -633,9 +633,13 @@ QObject *json_parser_parse(QList *tokens, va_list *ap)
QObject *json_parser_parse_err(QList *tokens, va_list *ap, Error **errp)
{
JSONParserContext ctxt = {};
QList *working = qlist_copy(tokens);
QList *working;
QObject *result;
if (!tokens) {
return NULL;
}
working = qlist_copy(tokens);
result = parse_value(&ctxt, &working, ap);
QDECREF(working);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册