mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
10l bug, use av_fast_malloc() instead if av_malloc() for allocating audio
buffers. This and the previous revision fix a heap overflow. Originally committed as revision 20769 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
15bfe412b7
commit
b8919a3092
9
ffmpeg.c
9
ffmpeg.c
@ -219,6 +219,7 @@ static int64_t timer_start;
|
||||
|
||||
static uint8_t *audio_buf;
|
||||
static uint8_t *audio_out;
|
||||
unsigned int allocated_audio_out_size, allocated_audio_buf_size;
|
||||
|
||||
static short *samples;
|
||||
|
||||
@ -449,6 +450,7 @@ static int av_exit(int ret)
|
||||
av_free(sws_opts);
|
||||
av_free(audio_buf);
|
||||
av_free(audio_out);
|
||||
allocated_audio_buf_size= allocated_audio_out_size= 0;
|
||||
av_free(samples);
|
||||
|
||||
if (received_sigterm) {
|
||||
@ -579,11 +581,8 @@ static void do_audio_out(AVFormatContext *s,
|
||||
av_exit(1);
|
||||
}
|
||||
|
||||
/* SC: dynamic allocation of buffers */
|
||||
if (!audio_buf)
|
||||
audio_buf = av_malloc(audio_buf_size);
|
||||
if (!audio_out)
|
||||
audio_out = av_malloc(audio_out_size);
|
||||
av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size);
|
||||
av_fast_malloc(&audio_out, &allocated_audio_out_size, audio_out_size);
|
||||
if (!audio_buf || !audio_out)
|
||||
return; /* Should signal an error ! */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user