]> git.sesse.net Git - ffmpeg/commitdiff
ffmpeg: Check best_effort_timestamp after rescale
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 18 Feb 2016 00:07:33 +0000 (01:07 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 18 Feb 2016 00:46:59 +0000 (01:46 +0100)
Fixes integer overflow
Fixes: Ticket5126
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
ffmpeg.c

index a5ec3c38338eb6a02ccee07263368fcadbc55b35..c20f75a16d518dc4b63d2f1e2a747e2a256bf796 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2123,8 +2123,12 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
     ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;
 
     best_effort_timestamp= av_frame_get_best_effort_timestamp(decoded_frame);
-    if(best_effort_timestamp != AV_NOPTS_VALUE)
-        ist->next_pts = ist->pts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, ist->st->time_base, AV_TIME_BASE_Q);
+    if(best_effort_timestamp != AV_NOPTS_VALUE) {
+        int64_t ts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, ist->st->time_base, AV_TIME_BASE_Q);
+
+        if (ts != AV_NOPTS_VALUE)
+            ist->next_pts = ist->pts = ts;
+    }
 
     if (debug_ts) {
         av_log(NULL, AV_LOG_INFO, "decoder -> ist_index:%d type:video "