mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-08-31 17:55:23 +02:00
blocksActuallyRead rounded bytesRead up to the next whole block unconditionally, intending to handle the legitimate case where the very last block of the file is naturally shorter than BLOCK_SIZE (cache_ is deliberately over-allocated for that). But it applied the same rounding to any short read, including a genuine failure or a dropped connection mid-file (this loader can sit on top of the whole Remote ISO chain via CachingFileLoader/HTTPFileLoader when "Cache full ISO in RAM" is enabled) - marking a block as fully cached when only a few of its bytes were actually written. Since cache_ is malloc'd (not zeroed), every later read of that block would serve uninitialized heap memory as if it were real file data. Only round up when the short read's end position exactly matches the true end of the file.