avcodec/cbs_lcevc: append with position -1 in ff_cbs_lcevc_add_process_block()

ff_cbs_lcevc_list_add() resolves a position of -1 to the end of the
list, but the block was then set up at blocks[-1].

Fixes: Am7oZsN0qfFR/testcase/cbs_lcevc_append.c
Fixes: Am7oZsN0qfFR
Fixes: out of array write
Out of array write Replicated through API with ASAN

Found during the review of PR 25408.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer authored and michaelni committed 2026-11-06 04:40:30 +00:00
1 parent 60b286521b
commit a88221d8df
1 file changed
+3
+3
View File
@@ -628,6 +628,9 @@ int ff_cbs_lcevc_add_process_block(CodedBitstreamContext *ctx,
if (err < 0)
return err;
if (position == -1)
position = list->nb_blocks;
// Add a new block to the message list.
err = ff_cbs_lcevc_list_add(list, position);
if (err < 0)