avcodec/av1dec: sync frame header and tile group behavior with CBS

A new Sequence Header or a Temporal Delimiter OBU invalidate any previous frame
if not yet complete (As is the case of missing Tile Groups).
Similarly, a new Frame Header invalidates any onging Tile Group parsing.

Fixes: out of array access
Fixes: av1dec_tile_desync.mp4
Fixes: av1dec_tile_desync_bypass.mp4

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit a1496ced65)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
James Almer
2026-03-03 18:36:17 -03:00
committed by Michael Niedermayer
parent 7453c35298
commit 9fd68baff0
+8 -1
View File
@@ -1017,6 +1017,8 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
}
s->raw_seq = &obu->obu.sequence_header;
s->raw_frame_header = NULL;
raw_tile_group = NULL;
ret = set_context_with_sequence(avctx, s->raw_seq);
if (ret < 0) {
@@ -1066,6 +1068,8 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
goto end;
}
raw_tile_group = NULL;
if (unit->type == AV1_OBU_FRAME)
s->raw_frame_header = &obu->obu.frame.header;
else
@@ -1144,8 +1148,11 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame,
}
}
break;
case AV1_OBU_TILE_LIST:
case AV1_OBU_TEMPORAL_DELIMITER:
s->raw_frame_header = NULL;
raw_tile_group = NULL;
// fall-through
case AV1_OBU_TILE_LIST:
case AV1_OBU_PADDING:
case AV1_OBU_METADATA:
break;