You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2018/02/08 15:30:26 UTC
[2/4] lucy git commit: Don't pass negative token id to Lemon parser
Don't pass negative token id to Lemon parser
Newer Lemon versions throw an assertion if they encounter invalid
token ids.
Fixes LUCY-327. Thanks to Petr Pisar for the report.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e011b963
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e011b963
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e011b963
Branch: refs/heads/master
Commit: e011b963e34890921f87942d0073b56a81e2c6cf
Parents: d09e6d2
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Feb 8 14:29:11 2018 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Feb 8 16:07:13 2018 +0100
----------------------------------------------------------------------
core/Lucy/Util/Json.c | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/e011b963/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index 46a0b89..be19660 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -479,6 +479,12 @@ S_do_parse_json(void *json_parser, const char *json, size_t len) {
}
break;
}
+ if (token_type < 0) {
+ // Clear out parser and return.
+ LucyParseJson(json_parser, 0, NULL, &state);
+ SET_ERROR("JSON syntax error", save, end);
+ return NULL;
+ }
LucyParseJson(json_parser, token_type, value, &state);
if (state.errors) {
SET_ERROR("JSON syntax error", save, end);