while (TRUE) {
script_count = uscript_getScriptExtensions(
- codePoint, scripts.getAlias(), FIRST_GUESS_SCRIPT_CAPACITY, &internalStatus);
+ codePoint, scripts.getAlias(), scripts.getCapacity(), &internalStatus);
if (internalStatus == U_BUFFER_OVERFLOW_ERROR) {
// Need to allocate more space
if (scripts.resize(script_count) == NULL) {
return dest;
}
- // Check that at least one of the CONFUSABLE flags is turned on. If not,
- // return an error.
- if ((This->fChecks & USPOOF_CONFUSABLE) == 0) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return dest;
- }
-
UnicodeString nfdId;
gNfdNormalizer->normalize(id, nfdId, *status);
TESTCASE_AUTO(testRestrictionLevel);
TESTCASE_AUTO(testMixedNumbers);
TESTCASE_AUTO(testBug12153);
+ TESTCASE_AUTO(testBug12825);
+ TESTCASE_AUTO(testBug12815);
TESTCASE_AUTO_END;
}
TEST_ASSERT_SUCCESS(status);
}
+// uspoof_checkUnicodeString should NOT have an infinite loop.
+void IntlTestSpoof::testBug12825() {
+ UErrorCode status = U_ZERO_ERROR;
+ LocalUSpoofCheckerPointer sc(uspoof_open(&status));
+ TEST_ASSERT_SUCCESS(status);
+ uspoof_setChecks(sc.getAlias(), USPOOF_ALL_CHECKS | USPOOF_AUX_INFO, &status);
+ TEST_ASSERT_SUCCESS(status);
+ uspoof_checkUnicodeString(sc.getAlias(), UnicodeString("\\u30FB").unescape(), NULL, &status);
+ TEST_ASSERT_SUCCESS(status);
+}
+
+// uspoof_getSkeleton should NOT set an ILLEGAL_ARGUMENT_EXCEPTION.
+void IntlTestSpoof::testBug12815() {
+ UErrorCode status = U_ZERO_ERROR;
+ LocalUSpoofCheckerPointer sc(uspoof_open(&status));
+ TEST_ASSERT_SUCCESS(status);
+ uspoof_setChecks(sc.getAlias(), USPOOF_RESTRICTION_LEVEL, &status);
+ TEST_ASSERT_SUCCESS(status);
+ UnicodeString result;
+ uspoof_getSkeletonUnicodeString(sc.getAlias(), 0, UnicodeString("hello world"), result, &status);
+ TEST_ASSERT_SUCCESS(status);
+}
+
#endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS && !UCONFIG_NO_NORMALIZATION && !UCONFIG_NO_FILE_IO */