Fix possible underflow issue
Pointed out by nedwill_3ds here: https://www.reddit.com/r/3dshacks/comments/5nl1zi/wip_ctrmus_3ds_music_player/dcciivz/ Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
@@ -100,12 +100,13 @@ uint64_t fillOpusBuffer(OggOpusFile* opusFile, int16_t* bufferOut)
|
|||||||
|
|
||||||
while(samplesToRead > 0)
|
while(samplesToRead > 0)
|
||||||
{
|
{
|
||||||
uint64_t samplesJustRead = op_read_stereo(opusFile, bufferOut,
|
int samplesJustRead = op_read_stereo(opusFile, bufferOut,
|
||||||
samplesToRead > 120*48*2 ? 120*48*2 : samplesToRead);
|
samplesToRead > 120*48*2 ? 120*48*2 : samplesToRead);
|
||||||
|
|
||||||
if(samplesJustRead < 0)
|
if(samplesJustRead < 0)
|
||||||
{
|
{
|
||||||
printf("\nFatal error decoding Opus: %llu.", samplesJustRead);
|
/* TODO: Printing should not be done here. */
|
||||||
|
printf("\nFatal error decoding Opus: %d.", samplesJustRead);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(samplesJustRead == 0)
|
else if(samplesJustRead == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user