mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
mpegts: prevent division by zero
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
parent
ff100c9dd9
commit
1bbb18fe82
@ -2681,8 +2681,17 @@ static int mpegts_read_header(AVFormatContext *s)
|
|||||||
packet_count[nb_pcrs] = nb_packets;
|
packet_count[nb_pcrs] = nb_packets;
|
||||||
pcrs[nb_pcrs] = pcr_h * 300 + pcr_l;
|
pcrs[nb_pcrs] = pcr_h * 300 + pcr_l;
|
||||||
nb_pcrs++;
|
nb_pcrs++;
|
||||||
if (nb_pcrs >= 2)
|
if (nb_pcrs >= 2) {
|
||||||
break;
|
if (pcrs[1] - pcrs[0] > 0) {
|
||||||
|
/* the difference needs to be positive to make sense for bitrate computation */
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
av_log(ts->stream, AV_LOG_WARNING, "invalid pcr pair %"PRId64" >= %"PRId64"\n", pcrs[0], pcrs[1]);
|
||||||
|
pcrs[0] = pcrs[1];
|
||||||
|
packet_count[0] = packet_count[1];
|
||||||
|
nb_pcrs--;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
finished_reading_packet(s, ts->raw_packet_size);
|
finished_reading_packet(s, ts->raw_packet_size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user