Merge commit 'cc8163e1a3601a56f722a4720516e860bf1c6198'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Mar 2014 17:43:40 +0000 (18:43 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Mar 2014 17:43:40 +0000 (18:43 +0100)
* commit 'cc8163e1a3601a56f722a4720516e860bf1c6198':
  avcodec: more correct printf specifiers

Conflicts:
libavcodec/4xm.c
libavcodec/alsdec.c
libavcodec/dfa.c
libavcodec/h264_ps.c
libavcodec/jpeg2000dec.c
libavcodec/lagarith.c
libavcodec/mpeg12dec.c
libavcodec/rv10.c
libavcodec/svq3.c
libavcodec/wmaprodec.c
libavcodec/xwddec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
26 files changed:
1  2 
libavcodec/4xm.c
libavcodec/aic.c
libavcodec/alac.c
libavcodec/alsdec.c
libavcodec/apedec.c
libavcodec/bmp.c
libavcodec/cllc.c
libavcodec/dfa.c
libavcodec/dxtory.c
libavcodec/g2meet.c
libavcodec/h264_ps.c
libavcodec/ivi_common.c
libavcodec/jpeg2000dec.c
libavcodec/lagarith.c
libavcodec/metasound.c
libavcodec/mjpegbdec.c
libavcodec/mpeg12dec.c
libavcodec/mss12.c
libavcodec/rv10.c
libavcodec/svq3.c
libavcodec/truemotion2.c
libavcodec/tscc2.c
libavcodec/utvideodec.c
libavcodec/wmalosslessdec.c
libavcodec/wmaprodec.c
libavcodec/xwddec.c

@@@ -24,7 -24,8 +24,9 @@@
   * 4XM codec.
   */
  
+ #include <inttypes.h>
 +#include "libavutil/avassert.h"
  #include "libavutil/frame.h"
  #include "libavutil/imgutils.h"
  #include "libavutil/intreadwrite.h"
@@@ -828,10 -798,14 +830,10 @@@ static int decode_frame(AVCodecContext 
      if (buf_size < 20)
          return AVERROR_INVALIDDATA;
  
 -    if (avctx->width % 16 || avctx->height % 16) {
 -        av_log(avctx, AV_LOG_ERROR,
 -               "Dimensions non-multiple of 16 are invalid.\n");
 -        return AVERROR_INVALIDDATA;
 -    }
 +    av_assert0(avctx->width % 16 == 0 && avctx->height % 16 == 0);
  
      if (buf_size < AV_RL32(buf + 4) + 8) {
-         av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n",
+         av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %"PRIu32"\n",
                 buf_size, AV_RL32(buf + 4));
          return AVERROR_INVALIDDATA;
      }
Simple merge
@@@ -288,13 -283,14 +290,13 @@@ static int decode_element(AVCodecContex
          return AVERROR_INVALIDDATA;
      }
      if (!alac->nb_samples) {
 +        ThreadFrame tframe = { .f = frame };
          /* get output buffer */
          frame->nb_samples = output_samples;
 -        if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
 -            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
 +        if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0)
              return ret;
 -        }
      } else if (output_samples != alac->nb_samples) {
-         av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %u != %d\n",
+         av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %"PRIu32" != %d\n",
                 output_samples, alac->nb_samples);
          return AVERROR_INVALIDDATA;
      }
  /**
   * @file
   * MPEG-4 ALS decoder
 - * @author Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
 + * @author Thilo Borgmann <thilo.borgmann _at_ mail.de>
   */
  
+ #include <inttypes.h>
  #include "avcodec.h"
  #include "get_bits.h"
  #include "unary.h"
@@@ -722,7 -705,9 +724,9 @@@ static int read_var_block_data(ALSDecCo
                      int offset     = parcor_rice_table[sconf->coef_table][k][0];
                      quant_cof[k] = decode_rice(gb, rice_param) + offset;
                      if (quant_cof[k] < -64 || quant_cof[k] > 63) {
-                         av_log(avctx, AV_LOG_ERROR, "quant_cof %d is out of range.\n", quant_cof[k]);
+                         av_log(avctx, AV_LOG_ERROR,
 -                               "quant_cof %"PRIu32" is out of range\n",
++                               "quant_cof %"PRIu32" is out of range.\n",
+                                quant_cof[k]);
                          return AVERROR_INVALIDDATA;
                      }
                  }
Simple merge
Simple merge
Simple merge
@@@ -25,6 -26,6 +26,7 @@@
  #include "bytestream.h"
  #include "internal.h"
  
++#include "libavutil/avassert.h"
  #include "libavutil/imgutils.h"
  #include "libavutil/mem.h"
  
Simple merge
@@@ -699,10 -699,9 +700,10 @@@ static int g2m_decode_frame(AVCodecCont
          }
          switch (chunk_type) {
          case DISPLAY_INFO:
 +            got_header =
              c->got_header = 0;
              if (chunk_size < 21) {
-                 av_log(avctx, AV_LOG_ERROR, "Invalid display info size %d\n",
+                 av_log(avctx, AV_LOG_ERROR, "Invalid display info size %"PRIu32"\n",
                         chunk_size);
                  break;
              }
                  b_mask = bytestream2_get_be32(&bc);
                  if (r_mask != 0xFF0000 || g_mask != 0xFF00 || b_mask != 0xFF) {
                      av_log(avctx, AV_LOG_ERROR,
-                            "Invalid or unsupported bitmasks: R=%X, G=%X, B=%X\n",
+                            "Invalid or unsupported bitmasks: R=%"PRIX32", G=%"PRIX32", B=%"PRIX32"\n",
                             r_mask, g_mask, b_mask);
 -                    return AVERROR_PATCHWELCOME;
 +                    ret = AVERROR_PATCHWELCOME;
 +                    goto header_fail;
                  }
              } else {
                  avpriv_request_sample(avctx, "bpp=%d", c->bpp);
@@@ -546,7 -495,7 +548,7 @@@ int ff_h264_decode_seq_parameter_set(H2
      if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
          static const char csp[4][5] = { "Gray", "420", "422", "444" };
          av_log(h->avctx, AV_LOG_DEBUG,
-                "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d b%d reo:%d\n",
 -               "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %d/%d\n",
++               "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %d/%d b%d reo:%d\n",
                 sps_id, sps->profile_idc, sps->level_idc,
                 sps->poc_type,
                 sps->ref_frame_count,
Simple merge
   * JPEG 2000 image decoder
   */
  
+ #include <inttypes.h>
 +#include "libavutil/avassert.h"
  #include "libavutil/common.h"
  #include "libavutil/opt.h"
 +#include "libavutil/pixdesc.h"
  #include "avcodec.h"
  #include "bytestream.h"
  #include "internal.h"
@@@ -804,18 -705,25 +806,18 @@@ static int jpeg2000_decode_packet(Jpeg2
          nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width;
          for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
              Jpeg2000Cblk *cblk = prec->cblk + cblkno;
 -            if (bytestream2_get_bytes_left(&s->g) < cblk->lengthinc)
 +            if (   bytestream2_get_bytes_left(&s->g) < cblk->lengthinc
 +                || sizeof(cblk->data) < cblk->length + cblk->lengthinc + 2
 +            ) {
 +                av_log(s->avctx, AV_LOG_ERROR,
-                        "Block length %d or lengthinc %d is too large\n",
++                       "Block length %"PRIu16" or lengthinc %d is too large\n",
 +                       cblk->length, cblk->lengthinc);
                  return AVERROR_INVALIDDATA;
 -            /* Code-block data can be empty. In that case initialize data
 -             * with 0xFFFF. */
 -            if (cblk->lengthinc > 0) {
 -                bytestream2_get_bufferu(&s->g, cblk->data, cblk->lengthinc);
 -            } else {
 -                cblk->data[0] = 0xFF;
 -                cblk->data[1] = 0xFF;
              }
 +
 +            bytestream2_get_bufferu(&s->g, cblk->data + cblk->length, cblk->lengthinc);
              cblk->length   += cblk->lengthinc;
              cblk->lengthinc = 0;
 -
 -            if (cblk->length > sizeof(cblk->data)) {
 -                av_log(s->avctx, AV_LOG_ERROR,
 -                       "Block length %"PRIu16" > data size %zd\n",
 -                       cblk->length, sizeof(cblk->data));
 -                return AVERROR_INVALIDDATA;
 -            }
          }
      }
      return 0;
@@@ -711,8 -668,8 +713,8 @@@ static int lag_decode_frame(AVCodecCont
          break;
      default:
          av_log(avctx, AV_LOG_ERROR,
-                "Unsupported Lagarith frame type: %#x\n", frametype);
+                "Unsupported Lagarith frame type: %#"PRIu8"\n", frametype);
 -        return -1;
 +        return AVERROR_PATCHWELCOME;
      }
  
      *got_frame = 1;
Simple merge
Simple merge
@@@ -25,7 -25,8 +25,9 @@@
   * MPEG-1/2 decoder
   */
  
 +#define UNCHECKED_BITSTREAM_READER 1
+ #include <inttypes.h>
  #include "libavutil/attributes.h"
  #include "libavutil/internal.h"
  #include "libavutil/stereo3d.h"
@@@ -586,13 -588,8 +588,13 @@@ av_cold int ff_mss12_decode_init(MSS12C
                 avctx->coded_width, avctx->coded_height);
          return AVERROR_INVALIDDATA;
      }
 +    if (avctx->coded_width < 1 || avctx->coded_height < 1) {
 +        av_log(avctx, AV_LOG_ERROR, "Frame dimensions %dx%d too small",
 +               avctx->coded_width, avctx->coded_height);
 +        return AVERROR_INVALIDDATA;
 +    }
  
-     av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d\n",
+     av_log(avctx, AV_LOG_DEBUG, "Encoder version %"PRIu32".%"PRIu32"\n",
             AV_RB32(avctx->extradata + 4), AV_RB32(avctx->extradata + 8));
      if (version != AV_RB32(avctx->extradata + 4) > 1) {
          av_log(avctx, AV_LOG_ERROR,
@@@ -507,8 -490,8 +509,8 @@@ static av_cold int rv10_decode_init(AVC
      }
  
      if (avctx->debug & FF_DEBUG_PICT_INFO) {
--        av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", rv->sub_id,
 -               avctx->extradata_size >= 4 ? ((int *) avctx->extradata)[0] : -1);
++        av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%"PRIX32"\n", rv->sub_id,
 +               ((uint32_t *) avctx->extradata)[0]);
      }
  
      avctx->pix_fmt = AV_PIX_FMT_YUV420P;
   *
   * You will know you have these parameters passed correctly when the decoder
   * correctly decodes this file:
 - *  http://samples.libav.org/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov
 + *  http://samples.mplayerhq.hu/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov
   */
  
+ #include <inttypes.h>
  #include "libavutil/attributes.h"
  #include "internal.h"
  #include "avcodec.h"
@@@ -620,8 -615,9 +622,9 @@@ static int svq3_decode_mb(SVQ3Context *
              for (i = 0; i < 16; i += 2) {
                  vlc = svq3_get_ue_golomb(&h->gb);
  
 -                if (vlc >= 25) {
 +                if (vlc >= 25U) {
-                     av_log(h->avctx, AV_LOG_ERROR, "luma prediction:%d\n", vlc);
+                     av_log(h->avctx, AV_LOG_ERROR,
+                            "luma prediction:%"PRIu32"\n", vlc);
                      return -1;
                  }
  
  
      if (!IS_INTRA16x16(mb_type) &&
          (!IS_SKIP(mb_type) || h->pict_type == AV_PICTURE_TYPE_B)) {
 -        if ((vlc = svq3_get_ue_golomb(&h->gb)) >= 48{
 +        if ((vlc = svq3_get_ue_golomb(&h->gb)) >= 48U){
-             av_log(h->avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc);
+             av_log(h->avctx, AV_LOG_ERROR, "cbp_vlc=%"PRIu32"\n", vlc);
              return -1;
          }
  
@@@ -994,14 -986,12 +997,14 @@@ static av_cold int svq3_decode_init(AVC
              int offset                = get_bits_count(&gb) + 7 >> 3;
              uint8_t *buf;
  
 -            if (watermark_height > 0 &&
 -                (uint64_t)watermark_width * 4 > UINT_MAX / watermark_height)
 -                return -1;
 +            if (watermark_height <= 0 ||
 +                (uint64_t)watermark_width * 4 > UINT_MAX / watermark_height) {
 +                ret = -1;
 +                goto fail;
 +            }
  
              buf = av_malloc(buf_len);
-             av_log(avctx, AV_LOG_DEBUG, "watermark size: %dx%d\n",
+             av_log(avctx, AV_LOG_DEBUG, "watermark size: %ux%u\n",
                     watermark_width, watermark_height);
              av_log(avctx, AV_LOG_DEBUG,
                     "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n",
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -141,7 -145,7 +145,7 @@@ static int xwd_decode_frame(AVCodecCont
      }
  
      if (pixformat != XWD_Z_PIXMAP) {
-         avpriv_report_missing_feature(avctx, "Pixmap format %d", pixformat);
 -        av_log(avctx, AV_LOG_ERROR, "pixmap format %"PRIu32" unsupported\n", pixformat);
++        avpriv_report_missing_feature(avctx, "Pixmap format %"PRIu32, pixformat);
          return AVERROR_PATCHWELCOME;
      }