Merge pull request #19063 from hrydgard/atrac-change-databuf-check

atrac: Change the databuf check in sceAtracDecodeData
This commit is contained in:
Henrik Rydgård 2024-04-15 12:50:38 +02:00 committed by GitHub
commit a866e07082
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -239,10 +239,10 @@ static u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd) {
// Note that outAddr being null is completely valid here, used to skip data. // Note that outAddr being null is completely valid here, used to skip data.
static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishFlagAddr, u32 remainAddr) { static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 finishFlagAddr, u32 remainAddr) {
Atrac *atrac = getAtrac(atracID); Atrac *atrac = getAtrac(atracID);
if (atrac == NULL) { u32 err = AtracValidateData(atrac);
return ATRAC_ERROR_BAD_ATRACID; if (err != 0) {
} else if (!atrac->dataBuf_) { // TODO: Should check bufferState instead? // Already logged.
return ATRAC_ERROR_NO_DATA; return err;
} }
u32 numSamples = 0; u32 numSamples = 0;