diff mbox

[FFmpeg-devel,4/5] avcodec/cbs: fix crash in sei_pic_timestamp

Message ID 20181012040204.21579-4-ffmpeg@tmm1.net
State Accepted
Commit b6c3a02740871f4992ab7c34a95dfa53a56ba382
Headers show

Commit Message

Aman Karmani Oct. 12, 2018, 4:02 a.m. UTC
From: Aman Gupta <aman@tmm1.net>

Signed-off-by: Aman Gupta <aman@tmm1.net>
---
 libavcodec/cbs_h264_syntax_template.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index 32e6acd68e..106da0630e 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -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)