[FFmpeg-devel] [PATCH 2/8] ffmdec: check codec pointer before use
Michael Niedermayer
michaelni at gmx.at
Mon Mar 9 04:56:34 CET 2015
On Mon, Mar 09, 2015 at 12:03:11AM +0100, Andreas Cadhalpun wrote:
> Hi,
>
> attached patch fixes potential crashes.
>
> Best regards,
> Andreas
> ffmdec.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
> fa490a9bc11b6c8748f707fabf79d28de237ef30 0002-ffmdec-check-codec-pointer-before-use.patch
> From 011296153f6e0e0112803474c41c4afa840a1e6d Mon Sep 17 00:00:00 2001
> From: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> Date: Sun, 8 Mar 2015 23:07:25 +0100
> Subject: [PATCH 2/8] ffmdec: check codec pointer before use
>
> It is only set in the COMM case of the switch statement, but that is not
> guaranteed to come before the others.
>
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
> libavformat/ffmdec.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
> index 280a24c..af37e74 100644
> --- a/libavformat/ffmdec.c
> +++ b/libavformat/ffmdec.c
> @@ -259,7 +259,7 @@ static int ffm2_read_header(AVFormatContext *s)
> FFMContext *ffm = s->priv_data;
> AVStream *st;
> AVIOContext *pb = s->pb;
> - AVCodecContext *codec;
> + AVCodecContext *codec = NULL;
> int ret;
> int f_main = 0, f_cprv = -1, f_stvi = -1, f_stau = -1;
> AVCodec *enc;
ok
arent the other checks redundant though ?
as the "counters" would be -1 if codec hasnt been allocated
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150309/bd022d68/attachment.asc>
More information about the ffmpeg-devel
mailing list