libyang BUGFIX avoid invalid parameters for memmove and memcpy
diff --git a/src/schema_compile_amend.c b/src/schema_compile_amend.c
index 65d9dfa..1ea084b 100644
--- a/src/schema_compile_amend.c
+++ b/src/schema_compile_amend.c
@@ -1068,7 +1068,9 @@
         } \
         LY_ARRAY_DECREMENT(ORIG_ARRAY); \
         FREE_FUNC(ctx->ctx, &(ORIG_ARRAY)[v]); \
-        memmove(&(ORIG_ARRAY)[v], &(ORIG_ARRAY)[v + 1], (LY_ARRAY_COUNT(ORIG_ARRAY) - v) * sizeof *(ORIG_ARRAY)); \
+        if (v < LY_ARRAY_COUNT(ORIG_ARRAY)) { \
+            memmove(&(ORIG_ARRAY)[v], &(ORIG_ARRAY)[v + 1], (LY_ARRAY_COUNT(ORIG_ARRAY) - v) * sizeof *(ORIG_ARRAY)); \
+        } \
     } \
     if (!LY_ARRAY_COUNT(ORIG_ARRAY)) { \
         LY_ARRAY_FREE(ORIG_ARRAY); \