Describe the bug
System.OverflowException converting a large FileStream length to an int in GetBufferSize().
To Reproduce
Steps to reproduce the behavior:
- Try to encrypt a 3 GB file.
Expected behaviour
File encryption should occur as expected without an exception.
Error log
Unhandled exception. System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ThrowInt32OverflowException()
at System.Convert.ToInt32(Int64 value)
at KryptorCLI.FileHandling.GetBufferSize(Int64 fileStreamLength)
at KryptorCLI.Encryption.EncryptFile(String filePath, String encryptedFilePath, Byte[] salt, Byte[] nonce, ValueTuple`2 keys)
at KryptorCLI.Encryption.InitializeEncryption(String filePath, Byte[] passwordBytes)
at KryptorCLI.FileEncryption.CallEncryption(Boolean encryption, String filePath, Byte[] passwordBytes)
at KryptorCLI.FileEncryption.GetFilePaths(Boolean encryption, String[] filePaths, Byte[] passwordBytes)
at KryptorCLI.FileEncryption.StartEncryption(Boolean encryption, String[] filePaths, Byte[] passwordBytes, String keyfilePath)
at KryptorCLI.CommandLine.CallEncryption(Boolean encryption, Char[] password, String keyfilePath, String[] filePaths)
at KryptorCLI.CommandLine.ValidateFileEncryptionInput(Boolean encryption, Char[] password, String keyfilePath, String[] filePaths)
at KryptorCLI.Program.OnExecute()
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](CommandLineContext context, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](IConsole console, String[] args)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](String[] args)
at KryptorCLI.Program.Main(String[] args)
Aborted (core dumped)
Desktop (please complete the following information):
- OS: Linux
- Version: CLI v2.2.0 Beta