tests: cover truncated \u escape at end of buffer in match_string2

This commit is contained in:
alhudz
2026-06-02 11:42:16 +05:30
parent 524b0d07f2
commit d42de7580d
+10
View File
@@ -1856,6 +1856,16 @@ TEST(parsing, unicode)
si = s.begin();
EXPECT_THROW(epee::misc_utils::parse::match_string2(si, s.end(), bs), std::runtime_error);
// truncated \u escape with buf_end right after the hex digits must throw,
// not read past buf_end (the closing quote is absent here on purpose)
s = "\"\\u123";
si = s.begin();
EXPECT_THROW(epee::misc_utils::parse::match_string2(si, s.end(), bs), std::runtime_error);
s = "\"\\u";
si = s.begin();
EXPECT_THROW(epee::misc_utils::parse::match_string2(si, s.end(), bs), std::runtime_error);
s = "\"\\u1234\"";
si = s.begin();
epee::misc_utils::parse::match_string2(si, s.end(), bs);