diff mbox series

[FFmpeg-devel] lavc/vaapi_decode: Reject decoding of frames with no slices

Message ID 20240510095535.101430-2-nowrep@gmail.com
State New
Headers show
Series [FFmpeg-devel] lavc/vaapi_decode: Reject decoding of frames with no slices | expand

Commit Message

David Rosca May 10, 2024, 9:55 a.m. UTC
Matches other hwaccels.
---
 libavcodec/vaapi_decode.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Xiang, Haihao May 13, 2024, 6:43 a.m. UTC | #1
On Vr, 2024-05-10 at 11:55 +0200, David Rosca wrote:
> Matches other hwaccels.
> ---
>  libavcodec/vaapi_decode.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index 8e9f647c20..3c4030c073 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -157,6 +157,11 @@ int ff_vaapi_decode_issue(AVCodecContext *avctx,
>      VAStatus vas;
>      int err;
>  
> +    if (pic->nb_slices <= 0) {
> +        err = -1;

Better to return a valid averror code, e.g. AVERROR(EINVAL).

Thanks
Haihao

> +        goto fail;
> +    }
> +
>      av_log(avctx, AV_LOG_DEBUG, "Decode to surface %#x.\n",
>             pic->output_surface);
>
diff mbox series

Patch

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 8e9f647c20..3c4030c073 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -157,6 +157,11 @@  int ff_vaapi_decode_issue(AVCodecContext *avctx,
     VAStatus vas;
     int err;
 
+    if (pic->nb_slices <= 0) {
+        err = -1;
+        goto fail;
+    }
+
     av_log(avctx, AV_LOG_DEBUG, "Decode to surface %#x.\n",
            pic->output_surface);