PR #24329 opened by add-uos-ffmpeg
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24329
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24329.patch

In stream_group_specifier_match(), the usable_only validation for
AV_STREAM_GROUP_PARAMS_TILE_GRID checked tg->nb_tiles twice and never
verified that tg->offsets was allocated. A tile grid with nb_tiles > 0
but a NULL offsets array would pass the check despite being unusable.

Check tg->offsets instead of duplicating the nb_tiles check, matching
the struct contract that offsets is an nb_tiles-sized array that must
be allocated for a valid tile grid.


>From cbde8149817d2375ca1eadd0498f37f7fa5e51df Mon Sep 17 00:00:00 2001
From: zhanghongyuan <[email protected]>
Date: Mon, 31 Aug 2026 13:08:07 +0800
Subject: [PATCH] fftools/cmdutils: validate tile_grid offsets in usable_only
 check

In stream_group_specifier_match(), the usable_only validation for
AV_STREAM_GROUP_PARAMS_TILE_GRID checked tg->nb_tiles twice and never
verified that tg->offsets was allocated. A tile grid with nb_tiles > 0
but a NULL offsets array would pass the check despite being unusable.

Check tg->offsets instead of duplicating the nb_tiles check, matching
the struct contract that offsets is an nb_tiles-sized array that must
be allocated for a valid tile grid.
---
 fftools/cmdutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 9fdd680448..d9a5901e91 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1398,7 +1398,7 @@ unsigned stream_group_specifier_match(const 
StreamSpecifier *ss,
             case AV_STREAM_GROUP_PARAMS_TILE_GRID: {
                 const AVStreamGroupTileGrid *tg = candidate->params.tile_grid;
                 if (!tg->coded_width || !tg->coded_height || !tg->nb_tiles ||
-                    !tg->width       || !tg->height       || !tg->nb_tiles)
+                    !tg->width       || !tg->height       || !tg->offsets)
                     continue;
                 break;
             }
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to