-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CDVDFSV: Fixed pointer incorrectly getting incremented, when alignmen…
…t correction is performed. This resulted in the buffer getting overrun, causing memory corruption.
- Loading branch information
Showing
2 changed files
with
5 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd100a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sp193 This commit seems to cause an issues with Gitaroo Man (and perhaps more games). This commit seems to fix a buffer overrun issue. It looks like the overrun is 63 bytes maximum. Is this correct? Wouldn't it make more sense to make cdvdman_fs_buf 64 bytes larger and revert the rest of this commit?
cd100a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
cd100a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the alignment mechanism. The code needs to align the DMA target address for transfers to the EE side. This will fix transfers to misaligned buffers on the EE, but that buffer must still reside at an address that is at least a multiple of 4.
I changed the code because of an overrun. I could not tell why the original code read to an offset in cdvdfsv_rbuf and also read from this same address - which caused the overrun. Then in the common CDVDMAN header file, I re-evaluated the sizes of the buffers. As much as I tried, I could not understand why I chose the old value - it was off by 2, whereas this sort of correction can be done by reading one extra sector.
I believe the changes you see in this commit are incomplete, as I remember adding some comments too. Maybe some of them are in the adjacent commit.