get rid of undefined behavior and narrow supported entity reference range
diff --git a/tests/tests-skeletons/check-OCTET_STRING.c b/tests/tests-skeletons/check-OCTET_STRING.c
index 30564c1..bfbfc8f 100644
--- a/tests/tests-skeletons/check-OCTET_STRING.c
+++ b/tests/tests-skeletons/check-OCTET_STRING.c
@@ -8,8 +8,10 @@
enum encoding_type { HEX, BINARY, UTF8 };
+#define check(t, tag, buf, verify) check_impl(__LINE__, t, tag, buf, verify)
+
static void
-check(enum encoding_type type, char *tagname, char *xmlbuf, char *verify) {
+check_impl(int lineno, enum encoding_type type, char *tagname, char *xmlbuf, char *verify) {
size_t xmllen = strlen(xmlbuf);
size_t verlen = verify ? strlen(verify) : 0;
asn_TYPE_descriptor_t *td = &asn_DEF_OCTET_STRING;
@@ -32,8 +34,8 @@
}
rc = decoder(0, td, (void **)stp, tagname, xmlbuf, xmllen);
- printf("[%s] => [%s]:%zu vs [%s]:%zu, code %d\n",
- xmlbuf,
+ printf("%03d: [%s] => [%s]:%zu vs [%s]:%zu, code %d\n",
+ lineno, xmlbuf,
st ? (const char *)st->buf : "", st ? st->size : 0,
verify ? verify : "", verlen, rc.code);
@@ -123,6 +125,13 @@
check(UTF8, "z", "<z z z>a b</z z z>", "a b");
check(UTF8, "z", "<z z z>a b</z z z>", "a b");
check(UTF8, "z", "<z>a繃b</z>", "a\347\271\203b");
+ check(UTF8, "z", "<z>a俄|</z>", "a\xe4\xbf\x84|");
+ /* Last unicode point */
+ check(UTF8, "z", "<z>a|</z>", "a\xf4\x8f\xbf\xbf|");
+ check(UTF8, "z", "<z>a|</z>", "a\xf4\x8f\xbf\xbf|");
+ /* One past the last unicode point */
+ check(UTF8, "z", "<z>a�|</z>", "a�|");
+ check(UTF8, "z", "<z>a�|</z>", "a�|");
check(UTF8, "z", "<z>a�b</z>", "a�b");
check(UTF8, "z", "<z>a�b</z>", "a�b");
check(UTF8, "z", "<z>aĬ</z>", "aĬ");