mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Audiolib: Fix use-after-frees in Vorbis, FLAC, XA decoding
git-svn-id: https://svn.eduke32.com/eduke32@7684 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
19a5e86a35
commit
849b095b26
4 changed files with 18 additions and 9 deletions
|
@ -651,15 +651,20 @@ void MV_ReleaseFLACVoice(VoiceNode *voice)
|
|||
return;
|
||||
}
|
||||
|
||||
voice->rawdataptr = 0;
|
||||
if (fd->stream != NULL)
|
||||
{
|
||||
FLAC__stream_decoder_finish(fd->stream);
|
||||
FLAC__stream_decoder_delete(fd->stream);
|
||||
auto stream = fd->stream;
|
||||
fd->stream = nullptr;
|
||||
FLAC__stream_decoder_finish(stream);
|
||||
FLAC__stream_decoder_delete(stream);
|
||||
}
|
||||
free(fd->block);
|
||||
auto block = fd->block;
|
||||
voice->length = 0;
|
||||
voice->sound = nullptr;
|
||||
fd->block = nullptr;
|
||||
free(block);
|
||||
free(fd);
|
||||
|
||||
voice->rawdataptr = 0;
|
||||
}
|
||||
#else
|
||||
#include "_multivc.h"
|
||||
|
|
|
@ -460,10 +460,11 @@ void MV_ReleaseVorbisVoice( VoiceNode * voice )
|
|||
|
||||
auto vd = (vorbis_data *)voice->rawdataptr;
|
||||
|
||||
voice->rawdataptr = 0;
|
||||
voice->length = 0;
|
||||
voice->sound = nullptr;
|
||||
ov_clear(&vd->vf);
|
||||
free(vd);
|
||||
|
||||
voice->rawdataptr = 0;
|
||||
}
|
||||
#else
|
||||
#include "_multivc.h"
|
||||
|
|
|
@ -483,7 +483,8 @@ void MV_ReleaseXAVoice( VoiceNode * voice )
|
|||
return;
|
||||
}
|
||||
|
||||
free(xad);
|
||||
|
||||
voice->rawdataptr = 0;
|
||||
voice->length = 0;
|
||||
voice->sound = nullptr;
|
||||
free(xad);
|
||||
}
|
||||
|
|
|
@ -196,6 +196,8 @@ void MV_ReleaseXMPVoice(VoiceNode * voice)
|
|||
return;
|
||||
|
||||
voice->rawdataptr = 0;
|
||||
voice->length = 0;
|
||||
voice->sound = nullptr;
|
||||
|
||||
xmp_end_player(xmpd->context);
|
||||
xmp_release_module(xmpd->context);
|
||||
|
|
Loading…
Reference in a new issue