History

avformat/rtpdec: int overflow in start_time_realtime

This was previously adjusted by me in 6b3f9c2e92b. Unfortunately, I traded one integer overflow bug for another. Currently, NTP timestamps that exceed INT64_MAX (~Jan 20, 1968) will cause an overflow when passed to av_rescale. This patch replaces av_rescale, which operates on int64_t, with ff_parse_ntp_time, which operates on uint64_t. This will give the correct values for timestamps back around the NTP epoch and present day timestamps. Fixes ticket #11388.

Jonathan Baudanza committed 1 year ago

Commit c0fbb6d1 parent 251de171 file · +1 −1Browse files

Unified · Split

libavformat/rtsp.c+1−1
@@ -2320,7 +2320,7 @@ redo: · 2319 unmodified lines
2320 }2320 }
2321 // Make real NTP start time available in AVFormatContext2321 // Make real NTP start time available in AVFormatContext
2322 if (s->start_time_realtime == AV_NOPTS_VALUE) {2322 if (s->start_time_realtime == AV_NOPTS_VALUE) {
2323 s->start_time_realtime = av_rescale (rtpctx->first_rtcp_ntp_time, 1000000, 1LL << 32) - NTP_OFFSET_US;2323 s->start_time_realtime = ff_parse_ntp_time(rtpctx->first_rtcp_ntp_time) - NTP_OFFSET_US;
2324 if (rtpctx->st) {2324 if (rtpctx->st) {
2325 s->start_time_realtime -=2325 s->start_time_realtime -=
2326 av_rescale_q (rtpctx->rtcp_ts_offset, rtpctx->st->time_base, AV_TIME_BASE_Q);2326 av_rescale_q (rtpctx->rtcp_ts_offset, rtpctx->st->time_base, AV_TIME_BASE_Q);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t