}
uloc_getLanguage(localeID, langID, sizeof(langID), &status);
- if (U_FAILURE(status)) {
+ if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
return 0;
}
static void TestIsRightToLeft(void);
static void TestBadLocaleIDs(void);
+static void TestBug20370(void);
void PrintDataTable();
TESTCASE(TestToUnicodeLocaleType);
TESTCASE(TestToLegacyType);
TESTCASE(TestBadLocaleIDs);
+ TESTCASE(TestBug20370);
}
}
}
}
+
+// Test case for ICU-20370.
+// The issue shows as an Addresss Sanitizer failure.
+static void TestBug20370() {
+ const char *localeID = "x-privatebutreallylongtagfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar";
+ uint32_t lcid = uloc_getLCID(localeID);
+ if (lcid != 0) {
+ log_err("FAIL: Expected LCID value of 0 for invalid localeID input.");
+ }
+}