Re: [PATCH] media: rkvdec: hevc: cap EXT SPS RPS control counts before descriptor assembly

From: Detlev Casanova

Date: Fri May 22 2026 - 09:25:19 EST


Hi Mike,

On 5/20/26 20:57, Michael Bommarito wrote:
On Tue, May 19, 2026 at 9:04 AM Detlev Casanova
<detlev.casanova@xxxxxxxxxxxxx> wrote:
Still, did you try just changing the cap to 64 (.cfg.dims = { 64 },) ?
You'd need a test that sets the control from userspace though.

It should refuse setting the control if there are more than 64 elements,
therefore the hevc decoder will not run any function using the count
values from the SPS (See rkvdec-vdpu381-hevc.c:601)
Sure, I can test that and send a v2 for ST. My understanding is that
we have four spots we need to check across the flow though:

1. ST count > 64
2. LT count > 32
ST and LT can be handled through cfg.dims and when num_negative_pics / num_positive_pics are non-zero, the code check that ST and LT have actually been set. If not, they can be skipped.
3. num_negative_pics / num_positive_pics > 16
This could be checked in the validation step of the control in v4l2-core.
4. delta_idx_minus1 + 1 > i
This one would need to be checked in the construction code indeed.

So would you also want the same .cfg approach for the LT cap?
So yes for LT dimensions.

Detlev.