]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/av1_metadata_bsf: Check for the existence of units
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Fri, 2 Apr 2021 15:16:39 +0000 (17:16 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Fri, 2 Apr 2021 16:05:02 +0000 (18:05 +0200)
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>
libavcodec/av1_metadata_bsf.c

index 8cafe461d12a572927ff8a0efdb5827c230d8ac2..328db5c0da2e8dd279303154819bcd634e309e30 100644 (file)
@@ -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) {