Re: [FFmpeg-devel] [PATCH 2/2] avformat/mpc: deallocate frames array on errors

2019-07-31 Thread Michael Niedermayer
On Wed, Jul 24, 2019 at 11:35:38PM +0200, Michael Niedermayer wrote:
> Fixes: memleak on error path
> Fixes: 
> 15984/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5679918412726272
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mpc.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)

will apply

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 2/2] avformat/mpc: deallocate frames array on errors

2019-07-24 Thread Michael Niedermayer
Fixes: memleak on error path
Fixes: 
15984/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5679918412726272

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/mpc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index 487ff90c7d..a7b2e116ed 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -88,7 +88,7 @@ static int mpc_read_header(AVFormatContext *s)
 
 st = avformat_new_stream(s, NULL);
 if (!st)
-return AVERROR(ENOMEM);
+goto mem_error;
 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
 st->codecpar->codec_id = AV_CODEC_ID_MUSEPACK7;
 st->codecpar->channels = 2;
@@ -96,7 +96,7 @@ static int mpc_read_header(AVFormatContext *s)
 st->codecpar->bits_per_coded_sample = 16;
 
 if (ff_get_extradata(s, st->codecpar, s->pb, 16) < 0)
-return AVERROR(ENOMEM);
+goto mem_error;
 st->codecpar->sample_rate = mpc_rate[st->codecpar->extradata[2] & 3];
 avpriv_set_pts_info(st, 32, MPC_FRAMESIZE, st->codecpar->sample_rate);
 /* scan for seekpoints */
@@ -113,6 +113,9 @@ static int mpc_read_header(AVFormatContext *s)
 }
 
 return 0;
+mem_error:
+av_freep(>frames);
+return AVERROR(ENOMEM);
 }
 
 static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
-- 
2.22.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".