[FFmpeg-cvslog] avcodec/vvcdec: return error if CTU size > 128

Nuo Mi git at videolan.org
Sat Nov 30 04:06:58 EET 2024


ffmpeg | branch: master | Nuo Mi <nuomi2021 at gmail.com> | Sat Nov 23 17:32:38 2024 +0800| [4de67e874697271e189022b03cd619329d54603c] | committer: Nuo Mi

avcodec/vvcdec: return error if CTU size > 128

The v3 spec reserves CTU size 256. Currently, we use an uint8_t* table to hold cb_width and cb_height.
If a CTU size of 256 is not split, cb_width and cb_height will overflow to 0.
To avoid switching to uint16_t, rejecting CTU size 256 provides a simple solution.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4de67e874697271e189022b03cd619329d54603c
---

 libavcodec/vvc/ps.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c
index f32f1cc5a1..14cedfd1b3 100644
--- a/libavcodec/vvc/ps.c
+++ b/libavcodec/vvc/ps.c
@@ -649,6 +649,12 @@ static int decode_ps(VVCParamSets *ps, const CodedBitstreamH266Context *h266, vo
     if (ret < 0)
         return ret;
 
+    if (rsps->sps_log2_ctu_size_minus5 > 2) {
+        // CTU > 128 are reserved in vvc spec v3
+        av_log(log_ctx, AV_LOG_ERROR, "CTU size > 128. \n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     ret = decode_pps(ps, rpps);
     if (ret < 0)
         return ret;



More information about the ffmpeg-cvslog mailing list