This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Savefile corruption in r2690
#1
The changes in r2690, specifically jpcsp.HLE.kernel.types.SceUtilitySavedataParam are causing savefile corruption when savedata crypto mode is enabled. Line 505 is truncating the encrypted savedata improperly:
Code:
505    fileOutput.write(outBuf, 0, Math.min(length, outBuf.length));
The CryptoEngine produces encrypted savedata that is a few bytes larger than the original savedata, so forcing the encrypted output to be same length as the original is causing the data corruption. I believe line 505 should be reverted to:
Code:
505    fileOutput.write(outBuf);

Another problem is line 527:
Code:
527    int length = Math.min(outBuf.length, Math.min(fileSize, maxLength));
As long as the decrypted data is smaller than the encrypted data, then this code is harmless. However, if it ever happens that the decrypted data is bigger than the encrypted data, then improper truncation will occur during loading. I think the proper code should be:
Code:
527    int length = Math.min(outBuf.length, maxLength);

Finally, I believe line 531 should be:
Code:
531    return length;
Reply
#2
This should now be fixed as suggested in r2704.
Thank you for reviewing the code! Smile
Always include a complete log file at INFO level in your reports. Thanks! How to post a log
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)