summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-29 00:30:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-29 00:30:35 +0100
commit0e6aa0fef565fdb625673c60276e90c2ea091e8e (patch)
treef0b08a7f4b465aaa0d9144e9b837b18294db3df6 /libavcodec
parentf929abd0c3643b28a9552512d698cf61ad4d08fa (diff)
parentbbeb29133b55b7256d18f5aaab8b5c8e919a173a (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: adpcm: Clip step_index values read from the bitstream at the beginning of each frame. oma: don't read beyond end of leaf_table. doxygen: Remove documentation for non-existing parameters; misc small fixes. Indeo3: fix crashes on corrupt bitstreams. msmpeg4: Replace forward declaration by proper #include. segment: implement wrap around avf: reorder AVStream and AVFormatContext aacdec: Remove erroneous reference to global gain from the out of bounds scalefactor error message. Conflicts: libavcodec/indeo3.c libavformat/avformat.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aacdec.c7
-rw-r--r--libavcodec/adpcm.c14
-rw-r--r--libavcodec/indeo3.c10
-rw-r--r--libavcodec/msmpeg4.c4
-rw-r--r--libavcodec/wmaprodec.c1
-rw-r--r--libavcodec/wmavoice.c3
6 files changed, 17 insertions, 22 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 5a0fc44129..3d38645599 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -399,8 +399,6 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
/**
* Configure output channel order based on the current program configuration element.
*
- * @param che_pos current channel position configuration
- *
* @return Returns error status. 0 - OK, !0 - error
*/
static av_cold int output_configure(AACContext *ac,
@@ -459,8 +457,6 @@ static void flush(AVCodecContext *avctx)
/**
* Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit.
*
- * @param cpe_map Stereo (Channel Pair Element) map, NULL if stereo bit is not present.
- * @param sce_map mono (Single Channel Element) map
* @param type speaker type/position for these channels
*/
static void decode_channel_map(uint8_t layout_map[][3],
@@ -1037,7 +1033,6 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
int offset[3] = { global_gain, global_gain - 90, 0 };
int clipped_offset;
int noise_flag = 1;
- static const char *const sf_str[3] = { "Global gain", "Noise gain", "Intensity stereo position" };
for (g = 0; g < ics->num_window_groups; g++) {
for (i = 0; i < ics->max_sfb;) {
int run_end = band_type_run_end[idx];
@@ -1076,7 +1071,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
if (offset[0] > 255U) {
av_log(ac->avctx, AV_LOG_ERROR,
- "%s (%d) out of range.\n", sf_str[0], offset[0]);
+ "Scalefactor (%d) out of range.\n", offset[0]);
return -1;
}
sf[idx] = -ff_aac_pow2sf_tab[offset[0] - 100 + POW_SF2_ZERO];
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 54c1dc6983..559eb293ce 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -707,7 +707,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
for (channel = 0; channel < avctx->channels; channel++) {
cs = &c->status[channel];
cs->predictor = (int16_t)bytestream_get_le16(&src);
- cs->step_index = *src++;
+ cs->step_index = av_clip(*src++, 0, 88);
src++;
*samples++ = cs->predictor;
}
@@ -730,8 +730,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
c->status[0].predictor = (int16_t)AV_RL16(src + 10);
c->status[1].predictor = (int16_t)AV_RL16(src + 12);
- c->status[0].step_index = src[14];
- c->status[1].step_index = src[15];
+ c->status[0].step_index = av_clip(src[14], 0, 88);
+ c->status[1].step_index = av_clip(src[15], 0, 88);
/* sign extend the predictors */
src += 16;
diff_channel = c->status[1].predictor;
@@ -771,7 +771,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
for (channel = 0; channel < avctx->channels; channel++) {
cs = &c->status[channel];
cs->predictor = (int16_t)bytestream_get_le16(&src);
- cs->step_index = *src++;
+ cs->step_index = av_clip(*src++, 0, 88);
src++;
}
@@ -834,7 +834,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
src += 4; // skip sample count (already read)
for (i=0; i<=st; i++)
- c->status[i].step_index = bytestream_get_le32(&src);
+ c->status[i].step_index = av_clip(bytestream_get_le32(&src), 0, 88);
for (i=0; i<=st; i++)
c->status[i].predictor = bytestream_get_le32(&src);
@@ -1051,11 +1051,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
case CODEC_ID_ADPCM_IMA_SMJPEG:
if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) {
c->status[0].predictor = sign_extend(bytestream_get_le16(&src), 16);
- c->status[0].step_index = bytestream_get_le16(&src);
+ c->status[0].step_index = av_clip(bytestream_get_le16(&src), 0, 88);
src += 4;
} else {
c->status[0].predictor = sign_extend(bytestream_get_be16(&src), 16);
- c->status[0].step_index = bytestream_get_byte(&src);
+ c->status[0].step_index = av_clip(bytestream_get_byte(&src), 0, 88);
src += 1;
}
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index dce75fe116..83effae859 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -727,6 +727,8 @@ static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
SPLIT_CELL(ref_cell->height, curr_cell.height);
ref_cell->ypos += curr_cell.height;
ref_cell->height -= curr_cell.height;
+ if (ref_cell->height <= 0 || curr_cell.height <= 0)
+ return AVERROR_INVALIDDATA;
} else if (code == V_SPLIT) {
if (curr_cell.width > strip_width) {
/* split strip */
@@ -735,6 +737,8 @@ static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
SPLIT_CELL(ref_cell->width, curr_cell.width);
ref_cell->xpos += curr_cell.width;
ref_cell->width -= curr_cell.width;
+ if (ref_cell->width <= 0 || curr_cell.width <= 0)
+ return AVERROR_INVALIDDATA;
}
while (get_bits_left(&ctx->gb) >= 2) { /* loop until return */
@@ -890,14 +894,16 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
return AVERROR_INVALIDDATA;
if (width != ctx->width || height != ctx->height) {
+ int res;
+
av_dlog(avctx, "Frame dimensions changed!\n");
ctx->width = width;
ctx->height = height;
free_frame_buffers(ctx);
- if(allocate_frame_buffers(ctx, avctx) < 0)
- return AVERROR_INVALIDDATA;
+ if ((res = allocate_frame_buffers(ctx, avctx)) < 0)
+ return res;
avcodec_set_dimensions(avctx, width, height);
}
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index 65604dbe6b..232b82b219 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -34,6 +34,7 @@
#include "libavutil/x86_cpu.h"
#include "h263.h"
#include "mpeg4video.h"
+#include "vc1data.h"
/*
* You can also call this codec : MPEG4 with a twist !
@@ -59,9 +60,6 @@
static uint32_t v2_dc_lum_table[512][2];
static uint32_t v2_dc_chroma_table[512][2];
-/* vc1 externs */
-extern const uint8_t ff_wmv3_dc_scale_table[32];
-
#include "msmpeg4data.h"
#if CONFIG_ENCODERS //strangely gcc includes this even if it is not referenced
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 3fd4836fd9..9b533145bd 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1481,7 +1481,6 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len,
*@brief Decode a single WMA packet.
*@param avctx codec context
*@param data the output buffer
- *@param data_size number of bytes that were written to the output buffer
*@param avpkt input packet
*@return number of bytes that were read from the input buffer
*/
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 2be0cf25f2..d4b7a3e1cd 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -1725,9 +1725,6 @@ static int check_bits_for_superframe(GetBitContext *orig_gb,
* (if less than 480), usually used to prevent blanks at track boundaries.
*
* @param ctx WMA Voice decoder context
- * @param samples pointer to output buffer for voice samples
- * @param data_size pointer containing the size of #samples on input, and the
- * amount of #samples filled on output
* @return 0 on success, <0 on error or 1 if there was not enough data to
* fully parse the superframe
*/