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

[Bug report]Fat32 file size is not the real size could raise Error #413

Open
jehuty1980 opened this issue Feb 16, 2024 · 0 comments
Open

Comments

@jehuty1980
Copy link

Problem

me.jahnen.libaums.core.driver.scsi.ScsiBlockDevice.kt
line 326
require(buffer.remaining() % blockSize == 0) { "buffer.remaining() must be multiple of blockSize!" }
This will check the remaining buffer is multiple of the blockSize, but in Fat/Fat32, file size which recorded at x1c offset is the FILE SIZE, not the REAL occupied size.

For the fatfile, it returns the FILE SIZE:
(1)me.jahnen.libaums.core.fs.fat32.FatFile.kt, line 54
get() = entry.fileSize
(2)me.jahnen.libaums.core.fs.fat32.FatLfnDirectoryEntry.kt, line 117
get() = actualEntry.fileSize
(3)me.jahnen.libaums.core.fs.fat32.FatDirectoryEntry.kt, line 282
get() = getUnsignedInt32(FILE_SIZE_OFF)

I think either rewrite the FatFile.fileSize with adding some "round to blockSize" codes, or add a getRealFileSize() function would be OK.

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

1 participant