xml BUGFIX regard to utf8 in lyxml_parse_value()
diff --git a/src/xml.c b/src/xml.c
index 2f027b4..e4bc8bd 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -344,7 +344,7 @@
#define BUFSIZE_STEP 128
const struct ly_ctx *ctx = xmlctx->ctx; /* shortcut */
- const char *in = xmlctx->in->current, *start;
+ const char *in = xmlctx->in->current, *start, *in_aux;
char *buf = NULL;
size_t offset; /* read offset in input buffer */
size_t len; /* length of the output string (write offset in output buffer) */
@@ -478,7 +478,10 @@
}
/* continue */
- ++offset;
+ in_aux = &in[offset];
+ LY_CHECK_ERR_GOTO(ly_getutf8(&in_aux, &n, &u),
+ LOGVAL(ctx, LY_VCODE_INCHAR, in[offset]), error);
+ offset += u;
}
}
diff --git a/tests/fuzz/corpus/lyd_parse_mem_xml/pull1537 b/tests/fuzz/corpus/lyd_parse_mem_xml/pull1537
new file mode 100644
index 0000000..4e5141a
--- /dev/null
+++ b/tests/fuzz/corpus/lyd_parse_mem_xml/pull1537
@@ -0,0 +1 @@
+<str xmlns='urn:tests:types'>'Ó<
\ No newline at end of file