[FFmpeg-devel] [PATCH] lavc/smvjpegdec: Avoid null dereference and return meaningful error codes

Michael Niedermayer michaelni at gmx.at
Wed Apr 1 17:33:57 CEST 2015


On Wed, Apr 01, 2015 at 08:45:02PM +0530, Himangi Saraogi wrote:
> ---
> This fixes CID 1292296.
> 
>  libavcodec/smvjpegdec.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
> index 5eca9bb..1eacc6c 100644
> --- a/libavcodec/smvjpegdec.c
> +++ b/libavcodec/smvjpegdec.c
> @@ -94,7 +94,7 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx)
>      SMVJpegDecodeContext *s = avctx->priv_data;
>      AVCodec *codec;
>      AVDictionary *thread_opt = NULL;
> -    int ret = 0;
> +    int ret = 0, r;
>  
>      s->frames_per_jpeg = 0;
>  
> @@ -115,13 +115,14 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx)
>  
>      if (s->frames_per_jpeg <= 0) {
>          av_log(avctx, AV_LOG_ERROR, "Invalid number of frames per jpeg.\n");
> -        ret = -1;
> +        ret = AVERROR(EINVAL);

AVERROR_INVALIDDATA as this comes from extradata which ultimately
comes from the input file

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

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- 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/20150401/a8ae0117/attachment.asc>


More information about the ffmpeg-devel mailing list