Merge remote-tracking branch 'qatar/release/0.7' into release/0.8
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Mar 2012 04:14:44 +0000 (05:14 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Mar 2012 04:14:44 +0000 (05:14 +0100)
* qatar/release/0.7: (96 commits)
  intfloat_readwrite: fix signed addition overflows
  smacker: validate channels and sample format.
  smacker: check buffer size before reading output size
  smacker: validate number of channels
  sipr: fix get_bits(0) calls
  motion_est: make MotionExtContext.map_generation unsigned
  4xm: prevent NULL dereference with invalid huffman table
  4xmdemux: prevent use of uninitialized memory
  4xm: clear FF_INPUT_BUFFER_PADDING_SIZE bytes in temporary buffers
  ptx: check for out of bound reads
  tiffdec: fix out of bound reads/writes
  eacmv: check for out of bound reads
  eacmv: fix potential pointer arithmetic overflows
  adpcm: fix out of bound reads due to integer overflow
  anm: prevent infinite loop
  avsdemux: check for out of bound writes
  avs: check for out of bound reads
  avsdemux: check for corrupted data
  mxfdec: Fix some buffer overreads caused by the misuse of AVPacket related functions.
  vaapi: Fix VC-1 decoding (reconstruct bitstream TTFRM correctly).
  ...

Conflicts:
libavcodec/adpcm.c
libavcodec/bink.c
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_cabac.c
libavcodec/h264_cavlc.c
libavcodec/motion_est_template.c
libavcodec/mpegvideo.c
libavcodec/nellymoserdec.c
libavcodec/ptx.c
libavcodec/svq3.c
libavcodec/vaapi_vc1.c
libavcodec/xan.c
libavfilter/vf_scale.c
libavformat/4xm.c
libavformat/flvdec.c
libavformat/mpeg.c
tests/ref/fate/motionpixels

Merged-by: Michael Niedermayer <michaelni@gmx.at>
26 files changed:
1  2 
doc/filters.texi
libavcodec/adpcm.c
libavcodec/bink.c
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_cabac.c
libavcodec/h264_cavlc.c
libavcodec/h264_ps.c
libavcodec/motion_est.c
libavcodec/motion_est_template.c
libavcodec/mpeg12enc.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavcodec/nellymoserdec.c
libavcodec/ptx.c
libavcodec/svq3.c
libavcodec/xan.c
libavfilter/vf_pad.c
libavfilter/vf_scale.c
libavfilter/vf_yadif.c
libavformat/4xm.c
libavformat/flvdec.c
libavformat/isom.c
libavformat/mpeg.c
libavformat/sol.c
libavutil/intfloat_readwrite.c

Simple merge
Simple merge
Simple merge
@@@ -106,9 -106,12 +106,12 @@@ int ff_h264_check_intra4x4_pred_mode(H2
      }
  
      return 0;
 -} //FIXME cleanup like ff_h264_check_intra_pred_mode
 +} //FIXME cleanup like check_intra_pred_mode
  
- static int check_intra_pred_mode(H264Context *h, int mode, int is_chroma){
+ /**
+  * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
+  */
+ int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma){
      MpegEncContext * const s = &h->s;
      static const int8_t top [7]= {LEFT_DC_PRED8x8, 1,-1,-1};
      static const int8_t left[7]= { TOP_DC_PRED8x8,-1, 2,-1,DC_128_PRED8x8};
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -366,8 -366,7 +366,8 @@@ static int init_duplicate_context(MpegE
      int i;
  
      // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264)
-     FF_ALLOCZ_OR_GOTO(s->avctx, s->allocated_edge_emu_buffer, (s->width+64)*2*21*2*2, fail); //(width + edge + align)*interlaced*MBsize*tolerance
-     s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21*2;
 -    FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer, (s->width+64)*2*21*2, fail); //(width + edge + align)*interlaced*MBsize*tolerance
++    FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer, (s->width+64)*2*21*2*2, fail); //(width + edge + align)*interlaced*MBsize*tolerance
++
  
       //FIXME should be linesize instead of s->width*2 but that is not known before get_buffer()
      FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad,  (s->width+64)*4*16*2*sizeof(uint8_t), fail)
Simple merge
@@@ -156,14 -156,14 +156,15 @@@ static int decode_tag(AVCodecContext * 
      const uint8_t *buf = avpkt->data;
      int buf_size = avpkt->size;
      NellyMoserDecodeContext *s = avctx->priv_data;
-     int blocks, i;
 +    int data_max = *data_size;
+     int blocks, i, block_size;
      int16_t* samples;
-     *data_size = 0;
      samples = (int16_t*)data;
  
-     if (buf_size < avctx->block_align)
+     if (buf_size < avctx->block_align) {
+         *data_size = 0;
          return buf_size;
+     }
  
      if (buf_size % 64) {
          av_log(avctx, AV_LOG_ERROR, "Tag size %d.\n", buf_size);
       */
  
      for (i=0 ; i<blocks ; i++) {
 +        if ((i + 1) * NELLY_SAMPLES * sizeof(int16_t) > data_max)
 +            return i > 0 ? i * NELLY_BLOCK_LEN : -1;
          nelly_decode_block(s, &buf[i*NELLY_BLOCK_LEN], s->float_buf);
          s->fmt_conv.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES);
-         *data_size += NELLY_SAMPLES*sizeof(int16_t);
      }
+     *data_size = blocks * block_size;
  
      return buf_size;
  }
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -219,22 -210,15 +219,24 @@@ static int config_props(AVFilterLink *o
      scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
                                  outlink->w, outlink->h, outlink->format,
                                  scale->flags, NULL, NULL, NULL);
 -    if (!scale->sws)
 +    if (scale->isws[0])
 +        sws_freeContext(scale->isws[0]);
 +    scale->isws[0] = sws_getContext(inlink ->w, inlink ->h/2, inlink ->format,
 +                                    outlink->w, outlink->h/2, outlink->format,
 +                                    scale->flags, NULL, NULL, NULL);
 +    if (scale->isws[1])
 +        sws_freeContext(scale->isws[1]);
 +    scale->isws[1] = sws_getContext(inlink ->w, inlink ->h/2, inlink ->format,
 +                                    outlink->w, outlink->h/2, outlink->format,
 +                                    scale->flags, NULL, NULL, NULL);
 +    if (!scale->sws || !scale->isws[0] || !scale->isws[1])
          return AVERROR(EINVAL);
  
-     if (inlink->sample_aspect_ratio.num){
-         outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio);
-     } else
 -
+     if (inlink->sample_aspect_ratio.num)
+         outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h*inlink->w,
+                                                              outlink->w*inlink->h},
+                                                 inlink->sample_aspect_ratio);
+     else
          outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
  
      return 0;
Simple merge
@@@ -172,11 -172,10 +172,11 @@@ static int fourxm_read_header(AVFormatC
                  goto fail;
              }
              if (current_track + 1 > fourxm->track_count) {
 -                fourxm->tracks = av_realloc(fourxm->tracks,
 -                    (current_track + 1) * sizeof(AudioTrack));
 +                fourxm->tracks = av_realloc_f(fourxm->tracks,
 +                                              sizeof(AudioTrack),
 +                                              current_track + 1);
                  if (!fourxm->tracks) {
-                     ret AVERROR(ENOMEM);
+                     ret = AVERROR(ENOMEM);
                      goto fail;
                  }
                  memset(&fourxm->tracks[fourxm->track_count], 0,
@@@ -173,10 -185,10 +173,10 @@@ static int parse_keyframes_index(AVForm
          }
      }
  
-     if (timeslen == fileposlen) {
-          for(i = 0; i < timeslen; i++)
 -    if (!ret && timeslen == fileposlen)
++    if (!ret && timeslen == fileposlen) {
+          for (i = 0; i < fileposlen; i++)
               av_add_index_entry(vstream, filepositions[i], times[i]*1000, 0, 0, AVINDEX_KEYFRAME);
 -    else
 +    else
          av_log(s, AV_LOG_WARNING, "Invalid keyframes object, skipping.\n");
  
  finish:
Simple merge
@@@ -423,8 -418,7 +423,8 @@@ static int mpegps_read_packet(AVFormatC
  {
      MpegDemuxContext *m = s->priv_data;
      AVStream *st;
-     int len, startcode, i, es_type;
+     int len, startcode, i, es_type, ret;
 +    int request_probe= 0;
      enum CodecID codec_id = CODEC_ID_NONE;
      enum AVMediaType type;
      int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
@@@ -129,9 -129,11 +129,11 @@@ static int sol_read_packet(AVFormatCont
  {
      int ret;
  
 -    if (s->pb->eof_reached)
 +    if (url_feof(s->pb))
          return AVERROR(EIO);
      ret= av_get_packet(s->pb, pkt, MAX_SIZE);
+     if (ret < 0)
+         return ret;
      pkt->stream_index = 0;
  
      /* note: we need to modify the packet size here to handle the last
Simple merge