mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-26 15:02:46 +00:00
import from UXP: [media] ffvpx patch: Fix leak in flac decoder in case of alloc failure. (9afa7a80)
This commit is contained in:
@@ -41,3 +41,8 @@ Run in the ffmpeg original tree:
|
||||
$ for i in `cat $PATH_CENTRAL/media/ffvpx/FILES`; do diff $REV_LASTSYNC HEAD >> patch.diff; done
|
||||
Then apply patch.diff on the ffvpx tree.
|
||||
Compilation will reveal if any files are missing.
|
||||
|
||||
========================
|
||||
|
||||
After updating, apply patches:
|
||||
flac-alloc-failure.patch fix leak in flac decoder in case of alloc failure
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
diff --git a/media/ffvpx/libavcodec/flacdec.c b/media/ffvpx/libavcodec/flacdec.c
|
||||
index 3d41a1af7f..8189d6af53 100644
|
||||
--- a/media/ffvpx/libavcodec/flacdec.c
|
||||
+++ b/media/ffvpx/libavcodec/flacdec.c
|
||||
@@ -146,8 +146,10 @@ static int allocate_buffers(FLACContext *s)
|
||||
return buf_size;
|
||||
|
||||
av_fast_malloc(&s->decoded_buffer, &s->decoded_buffer_size, buf_size);
|
||||
- if (!s->decoded_buffer)
|
||||
+ if (!s->decoded_buffer) {
|
||||
+ memset(s->decoded, 0, sizeof(s->decoded));
|
||||
return AVERROR(ENOMEM);
|
||||
+ }
|
||||
|
||||
ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL,
|
||||
s->decoded_buffer,
|
||||
@@ -525,7 +527,7 @@ static int decode_frame(FLACContext *s)
|
||||
fi.samplerate = s->flac_stream_info.samplerate;
|
||||
s->flac_stream_info.samplerate = s->avctx->sample_rate = fi.samplerate;
|
||||
|
||||
- if (!s->got_streaminfo) {
|
||||
+ if (!s->got_streaminfo || !s->decoded_buffer) {
|
||||
ret = allocate_buffers(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -146,8 +146,10 @@ static int allocate_buffers(FLACContext *s)
|
||||
return buf_size;
|
||||
|
||||
av_fast_malloc(&s->decoded_buffer, &s->decoded_buffer_size, buf_size);
|
||||
if (!s->decoded_buffer)
|
||||
if (!s->decoded_buffer) {
|
||||
memset(s->decoded, 0, sizeof(s->decoded));
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL,
|
||||
s->decoded_buffer,
|
||||
@@ -525,7 +527,7 @@ static int decode_frame(FLACContext *s)
|
||||
fi.samplerate = s->flac_stream_info.samplerate;
|
||||
s->flac_stream_info.samplerate = s->avctx->sample_rate = fi.samplerate;
|
||||
|
||||
if (!s->got_streaminfo) {
|
||||
if (!s->got_streaminfo || !s->decoded_buffer) {
|
||||
ret = allocate_buffers(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user