summaryrefslogtreecommitdiff
path: root/libavcodec/av1_metadata_bsf.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-02 17:16:39 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-02 18:05:02 +0200
commit8081a0b10f5325b60e885d8823593485019b8a18 (patch)
tree565a2595feb072784bfbde3a0d48a842d9418bb4 /libavcodec/av1_metadata_bsf.c
parentb917218c35d240d9266c163103353e51facb0cae (diff)
downloadffmpeg-8081a0b10f5325b60e885d8823593485019b8a18.tar.gz
avcodec/av1_metadata_bsf: Check for the existence of units
Fixes a crash with ISOBMFF extradata containing no OBUs. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/av1_metadata_bsf.c')
-rw-r--r--libavcodec/av1_metadata_bsf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c
index 8cafe461d1..328db5c0da 100644
--- a/libavcodec/av1_metadata_bsf.c
+++ b/libavcodec/av1_metadata_bsf.c
@@ -120,7 +120,7 @@ static int av1_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt,
}
// If a Temporal Delimiter is present, it must be the first OBU.
- if (frag->units[0].type == AV1_OBU_TEMPORAL_DELIMITER) {
+ if (frag->nb_units && frag->units[0].type == AV1_OBU_TEMPORAL_DELIMITER) {
if (ctx->td == BSF_ELEMENT_REMOVE)
ff_cbs_delete_unit(frag, 0);
} else if (pkt && ctx->td == BSF_ELEMENT_INSERT) {