Browse Source

av1_metadata: Error out if fragment is empty

If the fragment is empty after parsing (i.e. it contains no OBUs), then
the check for the type of the fragment's first OBU is nonsensical; so
error out in this case just as h264_metadata and hevc_metadata do.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
tags/n4.2
Andreas Rheinhardt Mark Thompson 6 years ago
parent
commit
3f81cc8c94
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      libavcodec/av1_metadata_bsf.c

+ 6
- 0
libavcodec/av1_metadata_bsf.c View File

@@ -133,6 +133,12 @@ static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
goto fail; goto fail;
} }


if (frag->nb_units == 0) {
av_log(bsf, AV_LOG_ERROR, "No OBU in packet.\n");
err = AVERROR_INVALIDDATA;
goto fail;
}

for (i = 0; i < frag->nb_units; i++) { for (i = 0; i < frag->nb_units; i++) {
if (frag->units[i].type == AV1_OBU_SEQUENCE_HEADER) { if (frag->units[i].type == AV1_OBU_SEQUENCE_HEADER) {
obu = frag->units[i].content; obu = frag->units[i].content;


Loading…
Cancel
Save