avformat/movenc: check that the input timestamps are within the range that can be stored in mov

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/56/merge
Michael Niedermayer 11 years ago
parent 76dd01ecd4
commit 1b872de8f4
  1. 11
      libavformat/movenc.c

@ -3255,6 +3255,17 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
int size = pkt->size; int size = pkt->size;
uint8_t *reformatted_data = NULL; uint8_t *reformatted_data = NULL;
if (trk->entry) {
int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts;
if (duration < 0 || 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 = trk->cluster[trk->entry - 1].dts + 1;
pkt->pts = AV_NOPTS_VALUE;
}
}
if (mov->flags & FF_MOV_FLAG_FRAGMENT) { if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
int ret; int ret;
if (mov->fragments > 0) { if (mov->fragments > 0) {

Loading…
Cancel
Save