When e2_pts == INT64_MIN and e1_pts >= 0 the calculation of e2_pts - e1_pts will overflow an int64_t.
Unified · Split
| @@ -2108,6 +2108,8 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance) · 2107 unmodified lines | |||
| 2108 | //We could use URLProtocol flags here but as many user applications do not use URLProtocols this would be unreliable | 2108 | //We could use URLProtocol flags here but as many user applications do not use URLProtocols this would be unreliable |
| 2109 | const char *proto = avio_find_protocol_name(s->url); | 2109 | const char *proto = avio_find_protocol_name(s->url); |
| 2110 | 2110 | ||
| 2111 | av_assert0(time_tolerance >= 0); | ||
| 2112 | |||
| 2111 | if (!proto) { | 2113 | if (!proto) { |
| 2112 | av_log(s, AV_LOG_INFO, | 2114 | av_log(s, AV_LOG_INFO, |
| 2113 | "Protocol name not provided, cannot determine if input is local or " | 2115 | "Protocol name not provided, cannot determine if input is local or " |
| @@ -2135,7 +2137,7 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance) · 21 unmodified lines | |||
| 2135 | for (; i2 < st2->nb_index_entries; i2++) { | 2137 | for (; i2 < st2->nb_index_entries; i2++) { |
| 2136 | AVIndexEntry *e2 = &st2->index_entries[i2]; | 2138 | AVIndexEntry *e2 = &st2->index_entries[i2]; |
| 2137 | int64_t e2_pts = av_rescale_q(e2->timestamp, st2->time_base, AV_TIME_BASE_Q); | 2139 | int64_t e2_pts = av_rescale_q(e2->timestamp, st2->time_base, AV_TIME_BASE_Q); |
| 2138 | if (e2_pts - e1_pts < time_tolerance) | 2140 | if (e2_pts < e1_pts || e2_pts - (uint64_t)e1_pts < time_tolerance) |
| 2139 | continue; | 2141 | continue; |
| 2140 | pos_delta = FFMAX(pos_delta, e1->pos - e2->pos); | 2142 | pos_delta = FFMAX(pos_delta, e1->pos - e2->pos); |
| 2141 | break; | 2143 | break; |