diff mbox series

[FFmpeg-devel] avcodec/zerocodec: Avoid undefined NULL - 0

Message ID GV1P250MB073791DF7D15569F081D077A8F549@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 1e1ddbb70dd13c00c2e7378c17b3435325b856cf
Headers show
Series [FFmpeg-devel] avcodec/zerocodec: Avoid undefined NULL - 0 | expand

Commit Message

Andreas Rheinhardt Sept. 28, 2022, 6:39 p.m. UTC
Fixes the zerocodec FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/zerocodec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Oct. 2, 2022, 4:28 p.m. UTC | #1
Andreas Rheinhardt:
> Fixes the zerocodec FATE-test.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/zerocodec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
> index 93fc2834e4..42fb24ff6c 100644
> --- a/libavcodec/zerocodec.c
> +++ b/libavcodec/zerocodec.c
> @@ -84,11 +84,12 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, AVFrame *pic,
>              return AVERROR_INVALIDDATA;
>          }
>  
> -        if (!(avpkt->flags & AV_PKT_FLAG_KEY))
> +        if (!(avpkt->flags & AV_PKT_FLAG_KEY)) {
>              for (j = 0; j < avctx->width << 1; j++)
>                  dst[j] += prev[j] & -!dst[j];
> +            prev -= prev_pic->linesize[0];
> +        }
>  
> -        prev -= prev_pic->linesize[0];
>          dst  -= pic->linesize[0];
>      }
>  

Will apply this patch tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
index 93fc2834e4..42fb24ff6c 100644
--- a/libavcodec/zerocodec.c
+++ b/libavcodec/zerocodec.c
@@ -84,11 +84,12 @@  static int zerocodec_decode_frame(AVCodecContext *avctx, AVFrame *pic,
             return AVERROR_INVALIDDATA;
         }
 
-        if (!(avpkt->flags & AV_PKT_FLAG_KEY))
+        if (!(avpkt->flags & AV_PKT_FLAG_KEY)) {
             for (j = 0; j < avctx->width << 1; j++)
                 dst[j] += prev[j] & -!dst[j];
+            prev -= prev_pic->linesize[0];
+        }
 
-        prev -= prev_pic->linesize[0];
         dst  -= pic->linesize[0];
     }