path UPDATE forbid positional predicate 0
Refs #1920
diff --git a/src/path.c b/src/path.c
index b6dc04a..9757699 100644
--- a/src/path.c
+++ b/src/path.c
@@ -130,6 +130,13 @@
} else if ((pred == LY_PATH_PRED_SIMPLE) && !lyxp_next_token(NULL, exp, tok_idx, LYXP_TOKEN_NUMBER)) {
/* Number */
+ /* check for index 0 */
+ if (!atoi(exp->expr + exp->tok_pos[*tok_idx - 1])) {
+ LOGVAL(ctx, LYVE_XPATH, "Invalid positional predicate \"%.*s\".", (int)exp->tok_len[*tok_idx - 1],
+ exp->expr + exp->tok_pos[*tok_idx - 1]);
+ goto token_error;
+ }
+
/* ']' */
LY_CHECK_GOTO(lyxp_next_token(ctx, exp, tok_idx, LYXP_TOKEN_BRACK2), token_error);