aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/tta.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-02-02 07:21:30 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-02-03 15:23:21 +0000
commitec524ed12aa1aeb37125203f1adf5aa10dfcb0de (patch)
treead2c145a8b8f19664e856b4e722a7ad71e45ebb0 /libavformat/tta.c
parenta6653787a4b1e89170ff7962312dd110769c83a3 (diff)
downloadffmpeg-ec524ed12aa1aeb37125203f1adf5aa10dfcb0de.tar.gz
tta: Fix framepos and start_offset types
Also propagate errors. CC: libav-stable@libav.org Bug-Id: CID 1238812
Diffstat (limited to 'libavformat/tta.c')
-rw-r--r--libavformat/tta.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/tta.c b/libavformat/tta.c
index e5e6e7186c..b7efe18b3c 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -45,12 +45,14 @@ static int tta_read_header(AVFormatContext *s)
TTAContext *c = s->priv_data;
AVStream *st;
int i, channels, bps, samplerate, datalen;
- uint64_t framepos, start_offset;
+ int64_t framepos, start_offset;
if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
ff_id3v1_read(s);
start_offset = avio_tell(s->pb);
+ if (start_offset < 0)
+ return start_offset;
if (avio_rl32(s->pb) != AV_RL32("TTA1"))
return -1; // not tta file
@@ -91,7 +93,10 @@ static int tta_read_header(AVFormatContext *s)
st->start_time = 0;
st->duration = datalen;
- framepos = avio_tell(s->pb) + 4*c->totalframes + 4;
+ framepos = avio_tell(s->pb);
+ if (framepos < 0)
+ return framepos;
+ framepos += 4 * c->totalframes + 4;
for (i = 0; i < c->totalframes; i++) {
uint32_t size = avio_rl32(s->pb);