Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ly_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ ly_getutf8(const char **input, uint32_t *utf8_char, uint32_t *bytes_read)
c = (c << 6) | (aux & 0x3f);
}

if ((c < 0x1000) || (c > 0x10ffff)) {
if ((c < 0x10000) || (c > 0x10ffff)) {
goto error;
}
} else {
Expand Down
11 changes: 11 additions & 0 deletions tests/utests/types/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,11 @@ test_data_xml(void **state)
CHECK_LOG_CTX("Entity reference \"&text;</po\" not supported, only predefined references allowed.", NULL, 1);
TEST_ERROR_XML("T0", "\"&#x8;\"");
CHECK_LOG_CTX("Invalid character reference \"&#x8;\"</port\" (0x00000008).", NULL, 1);
/* overlong 4-byte encodings of U+1000 and U+D800 */
TEST_ERROR_XML("T0", "\xf0\x81\x80\x80");
CHECK_LOG_CTX("Invalid character 0xf0.", NULL, 1);
TEST_ERROR_XML("T0", "\xf0\x8d\xa0\x80");
CHECK_LOG_CTX("Invalid character 0xf0.", NULL, 1);

/* TEST INVERTED PATTERN ADN LENGTH */
schema = MODULE_CREATE_YANG("T1", "leaf port {type string {"
Expand Down Expand Up @@ -928,6 +933,12 @@ test_data_json(void **state)
TEST_ERROR_JSON("T0", "aabb \\x");
CHECK_LOG_CTX("Invalid character escape sequence \\x.", NULL, 1);

/* overlong 4-byte encodings of U+1000 and U+D800 */
TEST_ERROR_JSON("T0", "\xf0\x81\x80\x80");
CHECK_LOG_CTX("Invalid character 0xf0.", NULL, 1);
TEST_ERROR_JSON("T0", "\xf0\x8d\xa0\x80");
CHECK_LOG_CTX("Invalid character 0xf0.", NULL, 1);

/* TEST INVERTED PATTERN ADN LENGTH */
schema = MODULE_CREATE_YANG("T1", "leaf port {type string {"
" length \"5 .. 10 | 20\";"
Expand Down
Loading