summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/tta.c15
-rw-r--r--libavformat/tta.c24
-rw-r--r--libavformat/version.h2
3 files changed, 13 insertions, 28 deletions
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index fd796d9243..0de3fe96ce 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -203,8 +203,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
s->avctx = avctx;
- // 30bytes includes a seektable with one frame
- if (avctx->extradata_size < 30)
+ // 30bytes includes TTA1 header
+ if (avctx->extradata_size < 22)
return AVERROR_INVALIDDATA;
init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size * 8);
@@ -278,17 +278,6 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
av_log(avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
s->data_length, s->frame_length, s->last_frame_length, total_frames);
- // FIXME: seek table
- if (avctx->extradata_size <= 26 || total_frames > INT_MAX / 4 ||
- avctx->extradata_size - 26 < total_frames * 4)
- av_log(avctx, AV_LOG_WARNING, "Seek table missing or too small\n");
- else if (avctx->err_recognition & AV_EF_CRCCHECK) {
- if (tta_check_crc(s, avctx->extradata + 22, total_frames * 4))
- return AVERROR_INVALIDDATA;
- }
- skip_bits_long(&s->gb, 32 * total_frames);
- skip_bits_long(&s->gb, 32); // CRC32 of seektable
-
if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){
av_log(avctx, AV_LOG_ERROR, "frame_length too large\n");
return AVERROR_INVALIDDATA;
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 656f914a5d..cb04ff44e0 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -96,6 +96,16 @@ static int tta_read_header(AVFormatContext *s)
framepos = avio_tell(s->pb) + 4*c->totalframes + 4;
+ st->codec->extradata_size = avio_tell(s->pb) - start_offset;
+ st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!st->codec->extradata) {
+ st->codec->extradata_size = 0;
+ return AVERROR(ENOMEM);
+ }
+
+ avio_seek(s->pb, start_offset, SEEK_SET);
+ avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
+
for (i = 0; i < c->totalframes; i++) {
uint32_t size = avio_rl32(s->pb);
av_add_index_entry(st, framepos, i * c->frame_size, size, 0,
@@ -110,20 +120,6 @@ static int tta_read_header(AVFormatContext *s)
st->codec->sample_rate = samplerate;
st->codec->bits_per_coded_sample = bps;
- st->codec->extradata_size = avio_tell(s->pb) - start_offset;
- if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
- //this check is redundant as avio_read should fail
- av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
- return -1;
- }
- st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
- if (!st->codec->extradata) {
- st->codec->extradata_size = 0;
- return AVERROR(ENOMEM);
- }
- avio_seek(s->pb, start_offset, SEEK_SET);
- avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
-
return 0;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index 3c0afbb1fd..8517fb17af 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MINOR 8
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \