aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-10 18:14:20 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-10 18:14:20 +0100
commit0d82c3a0ca6c5ed1e757a826b966687382f0180e (patch)
tree32714aaad2ac2b838073b264395f968b13b60e12 /libavformat
parentb7a750f67f68b41d5f3215906a5282b9cb7937d3 (diff)
parent979f77b0dc40571761999633a38d97be9a1670c8 (diff)
downloadffmpeg-0d82c3a0ca6c5ed1e757a826b966687382f0180e.tar.gz
Merge commit '979f77b0dc40571761999633a38d97be9a1670c8' into release/0.10
* commit '979f77b0dc40571761999633a38d97be9a1670c8': h264: check that an IDR NAL only contains I slices mov: Free an earlier allocated array if allocating a new one segafilm: fix leaks if reading the header fails h264_cavlc: check the size of the intra PCM data. cavs: Check for negative cbp avi: DV in AVI must be considered single stream avutil: use align == 0 for default alignment in audio sample buffer functions Conflicts: libavcodec/cavsdec.c libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avidec.c10
-rw-r--r--libavformat/mov.c1
-rw-r--r--libavformat/segafilm.c35
3 files changed, 28 insertions, 18 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 5a8d5a7741..0b43f09b3e 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -940,7 +940,7 @@ start_sync:
goto start_sync;
}
- n= get_stream_idx(d);
+ n = avi->dv_demux ? 0 : get_stream_idx(d);
if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(d+1) < s->nb_streams)
continue;
@@ -1394,12 +1394,17 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
int64_t pos, pos_min;
AVIStream *ast;
+ /* Does not matter which stream is requested dv in avi has the
+ * stream information in the first video stream.
+ */
+ if (avi->dv_demux)
+ stream_index = 0;
+
if (!avi->index_loaded) {
/* we only load the index on demand */
avi_load_index(s);
avi->index_loaded |= 1;
}
- assert(stream_index>= 0);
st = s->streams[stream_index];
ast= st->priv_data;
@@ -1417,7 +1422,6 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
/* One and only one real stream for DV in AVI, and it has video */
/* offsets. Calling with other stream indexes should have failed */
/* the av_index_search_timestamp call above. */
- assert(stream_index == 0);
if(avio_seek(s->pb, pos, SEEK_SET) < 0)
return -1;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4cb456744f..797705b0d9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1694,6 +1694,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (entries >= UINT_MAX / sizeof(*sc->stts_data))
return -1;
+ av_free(sc->stts_data);
sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));
if (!sc->stts_data)
return AVERROR(ENOMEM);
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 194a3b60bc..c12cd770d3 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -76,6 +76,16 @@ static int film_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
+static int film_read_close(AVFormatContext *s)
+{
+ FilmDemuxContext *film = s->priv_data;
+
+ av_freep(&film->sample_table);
+ av_freep(&film->stereo_buffer);
+
+ return 0;
+}
+
static int film_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
@@ -83,7 +93,7 @@ static int film_read_header(AVFormatContext *s,
AVIOContext *pb = s->pb;
AVStream *st;
unsigned char scratch[256];
- int i;
+ int i, ret;
unsigned int data_offset;
unsigned int audio_frame_counter;
@@ -210,14 +220,16 @@ static int film_read_header(AVFormatContext *s,
for (i = 0; i < film->sample_count; i++) {
/* load the next sample record and transfer it to an internal struct */
if (avio_read(pb, scratch, 16) != 16) {
- av_free(film->sample_table);
- return AVERROR(EIO);
+ ret = AVERROR(EIO);
+ goto fail;
}
film->sample_table[i].sample_offset =
data_offset + AV_RB32(&scratch[0]);
film->sample_table[i].sample_size = AV_RB32(&scratch[4]);
- if (film->sample_table[i].sample_size > INT_MAX / 4)
- return AVERROR_INVALIDDATA;
+ if (film->sample_table[i].sample_size > INT_MAX / 4) {
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
if (AV_RB32(&scratch[8]) == 0xFFFFFFFF) {
film->sample_table[i].stream = film->audio_stream_index;
film->sample_table[i].pts = audio_frame_counter;
@@ -240,6 +252,9 @@ static int film_read_header(AVFormatContext *s,
film->current_sample = 0;
return 0;
+fail:
+ film_read_close(s);
+ return ret;
}
static int film_read_packet(AVFormatContext *s,
@@ -320,16 +335,6 @@ static int film_read_packet(AVFormatContext *s,
return ret;
}
-static int film_read_close(AVFormatContext *s)
-{
- FilmDemuxContext *film = s->priv_data;
-
- av_free(film->sample_table);
- av_free(film->stereo_buffer);
-
- return 0;
-}
-
AVInputFormat ff_segafilm_demuxer = {
.name = "film_cpk",
.long_name = NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"),