diff mbox

[FFmpeg-devel] lavc/movtextdec.c: Avoid infinite loop on invalid data.

Message ID 1475029400-19105-1-git-send-email-isasi@google.com
State Accepted
Commit 7e9e1b7070242a79fa6e3acd749d7fe76e39ea7b
Headers show

Commit Message

Sasi Inguva Sept. 28, 2016, 2:23 a.m. UTC
Signed-off-by: Sasi Inguva <isasi@google.com>
---
 libavcodec/movtextdec.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Philip Langdale Sept. 28, 2016, 3:27 a.m. UTC | #1
On Tue, 27 Sep 2016 19:23:20 -0700
Sasi Inguva <isasi-at-google.com@ffmpeg.org> wrote:

> Signed-off-by: Sasi Inguva <isasi@google.com>
> ---
>  libavcodec/movtextdec.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> index abf8711..a33fff7 100644
> --- a/libavcodec/movtextdec.c
> +++ b/libavcodec/movtextdec.c
> @@ -471,6 +471,10 @@ static int mov_text_decode_frame(AVCodecContext
> *avctx, tsmb_type = AV_RB32(tsmb);
>              tsmb += 4;
>  
> +            if (tsmb_size == 0) {
> +              return AVERROR_INVALIDDATA;
> +            }
> +
>              if (tsmb_size == 1) {
>                  if (m->tracksize + 16 > avpkt->size)
>                      break;

Pushed. Thanks.

--phil
diff mbox

Patch

diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index abf8711..a33fff7 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -471,6 +471,10 @@  static int mov_text_decode_frame(AVCodecContext *avctx,
             tsmb_type = AV_RB32(tsmb);
             tsmb += 4;
 
+            if (tsmb_size == 0) {
+              return AVERROR_INVALIDDATA;
+            }
+
             if (tsmb_size == 1) {
                 if (m->tracksize + 16 > avpkt->size)
                     break;