[FFmpeg-devel] Abort early on decode_slice error

Submitted by Xiaohan Wang (王消寒) on Feb. 13, 2018, 8:24 p.m.

Details

Message ID CAF1j9YMytZA-19uHxTY+_=xdm4aEFRXp5Cz1Fgp3sc+AE7ouXg@mail.gmail.com
State New
Headers show

Commit Message

Xiaohan Wang (王消寒) Feb. 13, 2018, 8:24 p.m.
New patch as discussed offline:



On Sat, Feb 3, 2018 at 2:29 AM, Xiaohan Wang (王消寒) <xhwang@chromium.org>
wrote:

>
>

Comments

Michael Niedermayer Feb. 13, 2018, 11:51 p.m.
On Tue, Feb 13, 2018 at 12:24:41PM -0800, Xiaohan Wang (王消寒) wrote:
> New patch as discussed offline:
> 
> 
> 
> On Sat, Feb 3, 2018 at 2:29 AM, Xiaohan Wang (王消寒) <xhwang@chromium.org>
> wrote:
> 
> >
> >

>  h264_cavlc.c |    1 +
>  1 file changed, 1 insertion(+)
> a6bff5246e55cd4a75eff5ccaf5c8ecfd20c1cba  0001-ffmpeg-Set-valid-qscale-value-in-ff_h264_decode_mb_c.patch
> From e8ad6159640c913773583a8b551ecebcff6b9c63 Mon Sep 17 00:00:00 2001
> From: Xiaohan Wang <xhwang@chromium.org>
> Date: Sat, 3 Feb 2018 01:43:35 -0800
> Subject: [PATCH] ffmpeg: Set valid qscale value in ff_h264_decode_mb_cavlc()
> 
> When ff_h264_decode_mb_cavlc() failed due to wrong sl->qscale values,
> e.g. dquant out of range, set the qscale to be a valid value before
> returning -1 and exiting the function. The qscale value can be used
> later e.g. in loop filter.
> 
> BUG=806122
> ---
>  libavcodec/h264_cavlc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
> index 2421beed9d..a7e60676a0 100644
> --- a/libavcodec/h264_cavlc.c
> +++ b/libavcodec/h264_cavlc.c
> @@ -1110,6 +1110,7 @@ decode_intra_mb:
>              else                sl->qscale -= max_qp+1;
>              if (((unsigned)sl->qscale) > max_qp){
>                  av_log(h->avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, sl->mb_x, sl->mb_y);
> +                sl->qscale = max_qp;

will apply

thx

[...]

Patch hide | download patch | download mbox

From e8ad6159640c913773583a8b551ecebcff6b9c63 Mon Sep 17 00:00:00 2001
From: Xiaohan Wang <xhwang@chromium.org>
Date: Sat, 3 Feb 2018 01:43:35 -0800
Subject: [PATCH] ffmpeg: Set valid qscale value in ff_h264_decode_mb_cavlc()

When ff_h264_decode_mb_cavlc() failed due to wrong sl->qscale values,
e.g. dquant out of range, set the qscale to be a valid value before
returning -1 and exiting the function. The qscale value can be used
later e.g. in loop filter.

BUG=806122
---
 libavcodec/h264_cavlc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 2421beed9d..a7e60676a0 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -1110,6 +1110,7 @@  decode_intra_mb:
             else                sl->qscale -= max_qp+1;
             if (((unsigned)sl->qscale) > max_qp){
                 av_log(h->avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, sl->mb_x, sl->mb_y);
+                sl->qscale = max_qp;
                 return -1;
             }
         }
-- 
2.16.0.rc1.238.g530d649a79-goog