avcodec/cbs: fix crash in sei_pic_timestamp
authorAman Gupta <aman@tmm1.net>
Fri, 12 Oct 2018 03:42:58 +0000 (20:42 -0700)
committerAman Gupta <aman@tmm1.net>
Mon, 15 Oct 2018 18:52:49 +0000 (11:52 -0700)
Signed-off-by: Aman Gupta <aman@tmm1.net>
libavcodec/cbs_h264_syntax_template.c

index 32e6acd..106da06 100644 (file)
@@ -584,6 +584,12 @@ static int FUNC(sei_pic_timestamp)(CodedBitstreamContext *ctx, RWContext *rw,
     }
 
     sps = h264->active_sps;
+    if (!sps) {
+        av_log(ctx->log_ctx, AV_LOG_ERROR,
+               "No active SPS for pic_timestamp.\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (sps->vui.nal_hrd_parameters_present_flag)
         time_offset_length = sps->vui.nal_hrd_parameters.time_offset_length;
     else if (sps->vui.vcl_hrd_parameters_present_flag)