mirror of
https://github.com/mpv-player/mpv
synced 2025-03-18 17:40:30 +00:00
ad_pcm: fix crash at EOF
Fix use of unsigned type where negative values were needed. When playing a file with multichannel PCM audio the bug could result in the channel reorder function scrambling memory at the end of playback, causing a crash.
This commit is contained in:
parent
584b43e9f8
commit
c1c68a6914
@ -151,7 +151,7 @@ static int control(sh_audio_t * sh, int cmd, void *arg, ...)
|
||||
static int decode_audio(sh_audio_t * sh_audio, unsigned char *buf, int minlen,
|
||||
int maxlen)
|
||||
{
|
||||
unsigned len = sh_audio->channels * sh_audio->samplesize;
|
||||
int len = sh_audio->channels * sh_audio->samplesize;
|
||||
minlen = (minlen + len - 1) / len * len;
|
||||
if (minlen > maxlen)
|
||||
// if someone needs hundreds of channels adjust audio_out_minsize
|
||||
|
Loading…
Reference in New Issue
Block a user