Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加载文件目录下标异常 #26

Open
healzy99 opened this issue Jul 15, 2024 · 2 comments
Open

加载文件目录下标异常 #26

healzy99 opened this issue Jul 15, 2024 · 2 comments

Comments

@healzy99
Copy link

加载本地目录文件异常 D:\download\upload
System.ArgumentOutOfRangeException: 'minValue' cannot be greater than maxValue. (Parameter 'minValue')
at System.Random.ThrowMinMaxValueSwapped()
at System.Random.Next(Int32 minValue, Int32 maxValue)
at MDriveSync.Core.ShaHashHelper.GetSamplePoints(Int64 fileLength, Int32 sampleSize, Int32 numberOfRandomSamples, Int32 seed)
at MDriveSync.Core.ShaHashHelper.ComputeFileSampleHashHex(String filePath, String algorithm, Int32 seed)
at MDriveSync.Core.ShaHashHelper.ComputeFileSampleHash(String filePath, String alg, Int32 seed)
at MDriveSync.Core.ShaHashHelper.ComputeFileHash(String filePath, Int32 level, String alg, Int64 seed)
at MDriveSync.Core.AliyunJob.<>c__DisplayClass65_1.g__LoadFiles|4(String dir)

@Zrincet
Copy link

Zrincet commented Aug 26, 2024

if (fileLength <= sampleSize * (3 + numberOfRandomSamples))
{
return HashHelper.ComputeHash(stream, algorithm);
}

如果不满足fileLength <= sampleSize * (3 + numberOfRandomSamples)sampleSize 大于fileLength 时,

samplePoints[3 + i] = random.Next(0, (int)(fileLength - sampleSize));

random.Next 可能出现minValue大于maxValue的情况, @trueai-org 大佬看看是不是需要修改一下临界条件

@A1Panda
Copy link

A1Panda commented Nov 3, 2024

同样的问题 现在有办法解决吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants