Short circuit empty inputs.

This commit is contained in:
Chris Ross 2015-04-06 11:56:27 -07:00
parent c24a40517f
commit 31dae81405
1 changed files with 6 additions and 0 deletions

View File

@ -41,6 +41,12 @@ namespace Microsoft.AspNet.WebUtilities
{
ValidateParameters(input.Length, offset, count);
// Special-case empty input
if (count == 0)
{
return new byte[0];
}
// Assumption: input is base64url encoded without padding and contains no whitespace.
// First, we need to add the padding characters back.