Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2] lavc/vvc: Validate alf_list indexes
@ 2024-02-05 15:18 post
  2024-02-06 14:17 ` Nuo Mi
  0 siblings, 1 reply; 2+ messages in thread
From: post @ 2024-02-05 15:18 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Frank Plowman

From: Frank Plowman <post@frankplowman.com>

Signed-off-by: Frank Plowman <post@frankplowman.com>
---
 libavcodec/vvc/vvc_ps.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index 4ef8f9f9b9..9c4a74fc9c 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -1005,6 +1005,39 @@ int ff_vvc_decode_aps(VVCParamSets *ps, const CodedBitstreamUnit *unit)
     return ret;
 }
 
+static int sh_alf_aps(VVCSH *sh, const VVCFrameParamSets *fps)
+{
+    if (!sh->r->sh_alf_enabled_flag)
+        return 0;
+
+    for (int i = 0; i < sh->r->sh_num_alf_aps_ids_luma; i++) {
+        const VVCALF * alf_aps_luma = fps->alf_list[sh->r->sh_alf_aps_id_luma[i]];
+        if (!alf_aps_luma)
+            return AVERROR_INVALIDDATA;
+    }
+
+    if (sh->r->sh_alf_cb_enabled_flag || sh->r->sh_alf_cr_enabled_flag) {
+        const VVCALF* alf_aps_chroma = fps->alf_list[sh->r->sh_alf_aps_id_chroma];
+        if (!alf_aps_chroma)
+            return AVERROR_INVALIDDATA;
+    }
+
+    if (fps->sps->r->sps_ccalf_enabled_flag) {
+        if (sh->r->sh_alf_cc_cb_enabled_flag) {
+            const VVCALF *alf_aps_cc_cr = fps->alf_list[sh->r->sh_alf_cc_cb_aps_id];
+            if (!alf_aps_cc_cr)
+                return AVERROR_INVALIDDATA;
+        }
+        if (sh->r->sh_alf_cc_cr_enabled_flag) {
+            const VVCALF *alf_aps_cc_cr = fps->alf_list[sh->r->sh_alf_cc_cr_aps_id];
+            if (!alf_aps_cc_cr)
+                return AVERROR_INVALIDDATA;
+        }
+    }
+
+    return 0;
+}
+
 static void sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const VVCPPS *pps)
 {
     const int slice_address     = sh->r->sh_slice_address;
@@ -1123,8 +1156,12 @@ static int sh_derive(VVCSH *sh, const VVCFrameParamSets *fps)
     const H266RawSPS *sps           = fps->sps->r;
     const H266RawPPS *pps           = fps->pps->r;
     const H266RawPictureHeader *ph  = fps->ph.r;
+    int ret;
 
     sh_slice_address(sh, sps, fps->pps);
+    ret = sh_alf_aps(sh, fps);
+    if (ret < 0)
+        return ret;
     sh_inter(sh, sps, pps);
     sh_qp_y(sh, pps, ph);
     sh_deblock_offsets(sh);
-- 
2.43.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] lavc/vvc: Validate alf_list indexes
  2024-02-05 15:18 [FFmpeg-devel] [PATCH v2] lavc/vvc: Validate alf_list indexes post
@ 2024-02-06 14:17 ` Nuo Mi
  0 siblings, 0 replies; 2+ messages in thread
From: Nuo Mi @ 2024-02-06 14:17 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Frank Plowman

Applied.
Thank you

On Mon, Feb 5, 2024 at 11:18 PM <post@frankplowman.com> wrote:

> From: Frank Plowman <post@frankplowman.com>
>
> Signed-off-by: Frank Plowman <post@frankplowman.com>
> ---
>  libavcodec/vvc/vvc_ps.c | 37 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
>
> diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
> index 4ef8f9f9b9..9c4a74fc9c 100644
> --- a/libavcodec/vvc/vvc_ps.c
> +++ b/libavcodec/vvc/vvc_ps.c
> @@ -1005,6 +1005,39 @@ int ff_vvc_decode_aps(VVCParamSets *ps, const
> CodedBitstreamUnit *unit)
>      return ret;
>  }
>
> +static int sh_alf_aps(VVCSH *sh, const VVCFrameParamSets *fps)
> +{
> +    if (!sh->r->sh_alf_enabled_flag)
> +        return 0;
> +
> +    for (int i = 0; i < sh->r->sh_num_alf_aps_ids_luma; i++) {
> +        const VVCALF * alf_aps_luma =
> fps->alf_list[sh->r->sh_alf_aps_id_luma[i]];
> +        if (!alf_aps_luma)
> +            return AVERROR_INVALIDDATA;
> +    }
> +
> +    if (sh->r->sh_alf_cb_enabled_flag || sh->r->sh_alf_cr_enabled_flag) {
> +        const VVCALF* alf_aps_chroma =
> fps->alf_list[sh->r->sh_alf_aps_id_chroma];
> +        if (!alf_aps_chroma)
> +            return AVERROR_INVALIDDATA;
> +    }
> +
> +    if (fps->sps->r->sps_ccalf_enabled_flag) {
> +        if (sh->r->sh_alf_cc_cb_enabled_flag) {
> +            const VVCALF *alf_aps_cc_cr =
> fps->alf_list[sh->r->sh_alf_cc_cb_aps_id];
> +            if (!alf_aps_cc_cr)
> +                return AVERROR_INVALIDDATA;
> +        }
> +        if (sh->r->sh_alf_cc_cr_enabled_flag) {
> +            const VVCALF *alf_aps_cc_cr =
> fps->alf_list[sh->r->sh_alf_cc_cr_aps_id];
> +            if (!alf_aps_cc_cr)
> +                return AVERROR_INVALIDDATA;
> +        }
> +    }
> +
> +    return 0;
> +}
> +
>  static void sh_slice_address(VVCSH *sh, const H266RawSPS *sps, const
> VVCPPS *pps)
>  {
>      const int slice_address     = sh->r->sh_slice_address;
> @@ -1123,8 +1156,12 @@ static int sh_derive(VVCSH *sh, const
> VVCFrameParamSets *fps)
>      const H266RawSPS *sps           = fps->sps->r;
>      const H266RawPPS *pps           = fps->pps->r;
>      const H266RawPictureHeader *ph  = fps->ph.r;
> +    int ret;
>
>      sh_slice_address(sh, sps, fps->pps);
> +    ret = sh_alf_aps(sh, fps);
> +    if (ret < 0)
> +        return ret;
>      sh_inter(sh, sps, pps);
>      sh_qp_y(sh, pps, ph);
>      sh_deblock_offsets(sh);
> --
> 2.43.0
>
> _______________________________________________
> 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".
>
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-06 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 15:18 [FFmpeg-devel] [PATCH v2] lavc/vvc: Validate alf_list indexes post
2024-02-06 14:17 ` Nuo Mi

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git