diff mbox

[FFmpeg-devel] lavc/midivid: FIX CID 1456088

Message ID 1577023861-14542-1-git-send-email-zhongli_dev@126.com
State Superseded
Headers show

Commit Message

zhongli_dev@126.com Dec. 22, 2019, 2:11 p.m. UTC
Signed-off-by: Zhong Li <zhongli_dev@126.com>
---
 libavcodec/midivid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Dec. 22, 2019, 2:44 p.m. UTC | #1
Not ok, please use ret variable.

On 12/22/19, Zhong Li <zhongli_dev@126.com> wrote:
> Signed-off-by: Zhong Li <zhongli_dev@126.com>
> ---
>  libavcodec/midivid.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
> index 38465c5..6877c60 100644
> --- a/libavcodec/midivid.c
> +++ b/libavcodec/midivid.c
> @@ -73,7 +73,8 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext
> *avctx, AVFrame *frame)
>          if (bytestream2_get_bytes_left(gb) < mask_size)
>              return AVERROR_INVALIDDATA;
>
> -        init_get_bits8(&mask, mask_start, mask_size);
> +        if (init_get_bits8(&mask, mask_start, mask_size) < 0)
> +            return AVERROR_INVALIDDATA;
>          bytestream2_skip(gb, mask_size);
>          skip = s->skip;
>
> --
> 1.8.3.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
index 38465c5..6877c60 100644
--- a/libavcodec/midivid.c
+++ b/libavcodec/midivid.c
@@ -73,7 +73,8 @@  static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame)
         if (bytestream2_get_bytes_left(gb) < mask_size)
             return AVERROR_INVALIDDATA;
 
-        init_get_bits8(&mask, mask_start, mask_size);
+        if (init_get_bits8(&mask, mask_start, mask_size) < 0)
+            return AVERROR_INVALIDDATA;
         bytestream2_skip(gb, mask_size);
         skip = s->skip;