#11388: Overflow in start_time_realtime calculation in rtsp.c
-------------------------------------+-------------------------------------
             Reporter:               |                     Type:  defect
  IncrediBlame                       |
               Status:  new          |                 Priority:  normal
            Component:  ffmpeg       |                  Version:  git-
             Keywords:               |  master
  start_time_realtime RTSP RTCP      |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 start_time_realtime calculation was changed in realease/7.1 branch:
 
[https://github.com/FFmpeg/FFmpeg/blob/bb85423142103d694d97bad1967bd3dc55440e71/libavformat/rtsp.c#L2323]
 This is causing overflow, as av_rescale treats its args as int64_t, but
 rtpctx->first_rtcp_ntp_time used in calculation is uint64_t.
 Previous version worked, because the arg was shifted by an offset before
 used by av_rescale, but now shift is done after calculation.

 How to reproduce:
 {{{
 1. Add pprintf after calculation above.
 2. Build ffmpeg.
 2. Run
 % ffmpeg -i some_rtsp_source -c copy abc.mp4
 3. If rtsp source sends RTCP SR the code will eventually be hit, but sets
 the timestamp to some negative number.
 }}}

 Potential fix:
 {{{
 s->start_time_realtime = av_rescale (rtpctx->first_rtcp_ntp_time >> 2,
 1000000, 1LL << 30) - NTP_OFFSET_US;
 }}}
 should stop the overflow.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11388>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to