Merge remote-tracking branch 'qatar/master'

* qatar/master:
  h264: drop ff_h264_ prefix from static function ff_h264_decode_rbsp_trailing()
  h264: Make ff_h264_decode_end() static, it is not used externally.
  output-example: K&R formatting cosmetics, comment spelling fixes
  avf: make the example output the proper message
  avf: fix audio writing in the output-example
  mov: don't overwrite existing indexes.
  lzw: fix potential integer overflow.
  truemotion: forbid invalid VLC bitsizes and token values.
  truemotion2: handle out-of-frame motion vectors through edge extension.
  configure: Check for a different SDL function

Conflicts:
	configure
	doc/examples/muxing.c
	libavcodec/truemotion2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2012-03-30 22:10:17 +02:00
7 changed files with 224 additions and 141 deletions

View File

@ -1803,6 +1803,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
unsigned int stps_index = 0;
unsigned int i, j;
uint64_t stream_size = 0;
AVIndexEntry *mem;
/* adjust first dts according to edit list */
if ((sc->empty_duration || sc->start_time) && mov->time_scale > 0) {
@ -1832,12 +1833,13 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
if (!sc->sample_count || st->nb_index_entries)
return;
if (sc->sample_count >= UINT_MAX / sizeof(*st->index_entries))
if (sc->sample_count >= UINT_MAX / sizeof(*st->index_entries) - st->nb_index_entries)
return;
st->index_entries = av_malloc(sc->sample_count*sizeof(*st->index_entries));
if (!st->index_entries)
mem = av_realloc(st->index_entries, (st->nb_index_entries + sc->sample_count) * sizeof(*st->index_entries));
if (!mem)
return;
st->index_entries_allocated_size = sc->sample_count*sizeof(*st->index_entries);
st->index_entries = mem;
st->index_entries_allocated_size = (st->nb_index_entries + sc->sample_count) * sizeof(*st->index_entries);
for (i = 0; i < sc->chunk_count; i++) {
current_offset = sc->chunk_offsets[i];
@ -1921,12 +1923,13 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
}
av_dlog(mov->fc, "chunk count %d\n", total);
if (total >= UINT_MAX / sizeof(*st->index_entries))
if (total >= UINT_MAX / sizeof(*st->index_entries) - st->nb_index_entries)
return;
st->index_entries = av_malloc(total*sizeof(*st->index_entries));
if (!st->index_entries)
mem = av_realloc(st->index_entries, (st->nb_index_entries + total) * sizeof(*st->index_entries));
if (!mem)
return;
st->index_entries_allocated_size = total*sizeof(*st->index_entries);
st->index_entries = mem;
st->index_entries_allocated_size = (st->nb_index_entries + total) * sizeof(*st->index_entries);
// populate index
for (i = 0; i < sc->chunk_count; i++) {