mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-07-31 01:40:42 +00:00
Permissions, RateControl and Auditing
This commit is contained in:
@@ -56,6 +56,18 @@ internal static class ParserGuard
|
||||
"collection");
|
||||
}
|
||||
|
||||
internal static void EnsureTypeMetadataDepth(Warehouse? warehouse, int depth)
|
||||
{
|
||||
// Some compatibility entry points accept a null Warehouse. Keep those safe by
|
||||
// applying the built-in default rather than silently disabling this stack guard.
|
||||
var limit = warehouse?.Configuration.Parser.MaximumTypeMetadataDepth
|
||||
?? ParserConfiguration.DefaultMaximumTypeMetadataDepth;
|
||||
|
||||
if (limit > 0 && depth > limit)
|
||||
throw new ParserLimitException(
|
||||
$"TRU type metadata depth of {depth} exceeds the configured limit of {limit}.");
|
||||
}
|
||||
|
||||
internal static ulong MultiplySaturated(ulong value, ulong multiplier)
|
||||
=> value > ulong.MaxValue / multiplier ? ulong.MaxValue : value * multiplier;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user