summaryrefslogtreecommitdiff
path: root/libavcodec/av1_metadata_bsf.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-06-20 01:45:00 +0200
committerMark Thompson <sw@jkqxz.net>2019-07-07 22:40:55 +0100
commit3f81cc8c94586ccd500827b606c1eabfb6e2dadb (patch)
tree25e2dc4f973b71653a5a3778f5f605f02e94f85e /libavcodec/av1_metadata_bsf.c
parent3c8a2a1180f03ca6b299ebc27eef21ae86635ca0 (diff)
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>
Diffstat (limited to 'libavcodec/av1_metadata_bsf.c')
-rw-r--r--libavcodec/av1_metadata_bsf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c
index 842b80c201..bb2ca2075b 100644
--- a/libavcodec/av1_metadata_bsf.c
+++ b/libavcodec/av1_metadata_bsf.c
@@ -133,6 +133,12 @@ static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
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++) {
if (frag->units[i].type == AV1_OBU_SEQUENCE_HEADER) {
obu = frag->units[i].content;