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
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,13 @@ private static void LoadAppLocalIcu(string icuSuffixAndVersion, bool suffixWithS
if (indexOfSeparator >= 0)
{
icuSuffix = icuSuffixAndVersion.AsSpan().Slice(0, indexOfSeparator);

if (icuSuffix.Length > 35)
{
Environment.FailFast($"The resolved \"{icuSuffix.ToString()}\" suffix from System.Globalization.AppLocalIcu switch has to be < 20 chars long.");
}

version = icuSuffixAndVersion.AsSpan().Slice(icuSuffix.Length + 1);
}
else
{
version = icuSuffixAndVersion;
}

if (version.Length > 33)
{
Environment.FailFast($"The resolved version \"{version.ToString()}\" from System.Globalization.AppLocalIcu switch has to be < 33 chars long.");
}

if (suffixWithSeparator)
{
icuSuffix = string.Concat(icuSuffix, ".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,23 @@ void GlobalizationNative_InitICUFunctions(void* icuuc, void* icuin, const char*
char symbolVersion[MaxICUVersionStringWithSuffixLength + 1]="";
char symbolSuffix[SYMBOL_CUSTOM_SUFFIX_SIZE]="";

if (strlen(version) > (size_t)MaxICUVersionStringLength)
{
fprintf(stderr, "The resolved version \"%s\" from System.Globalization.AppLocalIcu switch has to be < %zu chars long.\n", version, (size_t)MaxICUVersionStringLength);
abort();
}

sscanf(version, "%d.%d.%d", &major, &minor, &build);

if (suffix != NULL)
{
size_t suffixAllowedSize = SYMBOL_CUSTOM_SUFFIX_SIZE - 2; // SYMBOL_CUSTOM_SUFFIX_SIZE considers `_` and `\0`.
if (strlen(suffix) > suffixAllowedSize)
{
fprintf(stderr, "The resolved suffix \"%s\" from System.Globalization.AppLocalIcu switch has to be < %zu chars long.\n", suffix, suffixAllowedSize);
abort();
}

assert(strlen(suffix) + 1 <= SYMBOL_CUSTOM_SUFFIX_SIZE);

#if defined(TARGET_WINDOWS)
Expand Down