MCPcopy Create free account
hub / github.com/acl-dev/acl / test_invalid_surrogate_input

Function test_invalid_surrogate_input

test/json/json_check.c:84–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84static int test_invalid_surrogate_input(void)
85{
86 ACL_JSON *json = acl_json_alloc();
87 const char *data =
88 "{\"high_only\":\"\\uD83D!\","
89 "\"high_bad_low\":\"\\uD83D\\u0041\","
90 "\"high_bad_u\":\"\\uD83D\\x\"}";
91 const char *expect_high_only = UTF8_REPLACEMENT "!";
92 const char *expect_high_bad_low = UTF8_REPLACEMENT "A";
93 const char *expect_high_bad_u = UTF8_REPLACEMENT "x";
94 int ok;
95
96 acl_json_update(json, data);
97 ok = acl_json_finish(json)
98 && check_tag_value(json, "high_only", expect_high_only)
99 && check_tag_value(json, "high_bad_low", expect_high_bad_low)
100 && check_tag_value(json, "high_bad_u", expect_high_bad_u);
101
102 acl_json_free(json);
103 return ok;
104}
105
106int main(void)
107{

Callers 1

mainFunction · 0.85

Calls 5

acl_json_allocFunction · 0.85
acl_json_updateFunction · 0.85
acl_json_finishFunction · 0.85
check_tag_valueFunction · 0.85
acl_json_freeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…