|
|
@ -4666,25 +4666,26 @@ static int check_pkt(AVFormatContext *s, AVPacket *pkt) |
|
|
|
{ |
|
|
|
{ |
|
|
|
MOVMuxContext *mov = s->priv_data; |
|
|
|
MOVMuxContext *mov = s->priv_data; |
|
|
|
MOVTrack *trk = &mov->tracks[pkt->stream_index]; |
|
|
|
MOVTrack *trk = &mov->tracks[pkt->stream_index]; |
|
|
|
|
|
|
|
int64_t ref; |
|
|
|
|
|
|
|
uint64_t duration; |
|
|
|
|
|
|
|
|
|
|
|
if (trk->entry) { |
|
|
|
if (trk->entry) { |
|
|
|
int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts; |
|
|
|
ref = trk->cluster[trk->entry - 1].dts; |
|
|
|
if (duration < 0 || duration > INT_MAX) { |
|
|
|
} else if (trk->start_dts != AV_NOPTS_VALUE) { |
|
|
|
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n", |
|
|
|
ref = trk->start_dts + trk->track_duration; |
|
|
|
duration, pkt->dts |
|
|
|
} else |
|
|
|
); |
|
|
|
ref = pkt->dts; // Skip tests for the first packet
|
|
|
|
|
|
|
|
|
|
|
|
pkt->dts = trk->cluster[trk->entry - 1].dts + 1; |
|
|
|
|
|
|
|
pkt->pts = AV_NOPTS_VALUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (pkt->dts <= INT_MIN || pkt->dts >= INT_MAX) { |
|
|
|
|
|
|
|
av_log(s, AV_LOG_ERROR, "Application provided initial timestamp: %"PRId64" is out of range for mov/mp4 format\n", |
|
|
|
|
|
|
|
pkt->dts |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pkt->dts = 0; |
|
|
|
duration = pkt->dts - ref; |
|
|
|
pkt->pts = AV_NOPTS_VALUE; |
|
|
|
if (pkt->dts < ref || duration >= INT_MAX) { |
|
|
|
|
|
|
|
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n", |
|
|
|
|
|
|
|
duration, pkt->dts |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pkt->dts = ref + 1; |
|
|
|
|
|
|
|
pkt->pts = AV_NOPTS_VALUE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (pkt->duration < 0 || pkt->duration > INT_MAX) { |
|
|
|
if (pkt->duration < 0 || pkt->duration > INT_MAX) { |
|
|
|
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration); |
|
|
|
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration); |
|
|
|
return AVERROR(EINVAL); |
|
|
|
return AVERROR(EINVAL); |
|
|
|