X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Ftta.c;h=6e513563bed11a69c90fdf0805ef5050d7c1eea5;hb=79f80f5c1f6e292af5d6413600e7129d36cb9be6;hp=4d0c6adeeed189c923ef201a4518ec68bf9b9f8d;hpb=c1c836d9eb4f790146eb2aca24260982587f00ed;p=ffmpeg diff --git a/libavformat/tta.c b/libavformat/tta.c index 4d0c6adeeed..6e513563bed 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -21,6 +21,7 @@ #include "libavcodec/get_bits.h" #include "avformat.h" +#include "internal.h" #include "id3v1.h" #include "libavutil/dict.h" @@ -72,8 +73,8 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0); c->currentframe = 0; - if(c->totalframes >= UINT_MAX/sizeof(uint32_t)){ - av_log(s, AV_LOG_ERROR, "totalframes too large\n"); + if(c->totalframes >= UINT_MAX/sizeof(uint32_t) || c->totalframes <= 0){ + av_log(s, AV_LOG_ERROR, "totalframes %d invalid\n", c->totalframes); return -1; } @@ -81,7 +82,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!st) return AVERROR(ENOMEM); - av_set_pts_info(st, 64, 1, samplerate); + avpriv_set_pts_info(st, 64, 1, samplerate); st->start_time = 0; st->duration = datalen; @@ -124,8 +125,8 @@ static int tta_read_packet(AVFormatContext *s, AVPacket *pkt) int size, ret; // FIXME! - if (c->currentframe > c->totalframes) - return -1; + if (c->currentframe >= c->totalframes) + return AVERROR_EOF; size = st->index_entries[c->currentframe].size;