summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-29 15:11:34 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-29 15:11:34 +0200
commitb96dc093eaf3adaf5df80559cbbaba00d1708adf (patch)
tree81ed0d099ff08881dde2451de4f5a7b119d272fd /libavcodec
parent8672fc7b0453098d862bb1c0caafab4823ee0b4e (diff)
parent065b3a1cfa3f23aedf76244b3f3883ba913173ff (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: wmalosslessdec: increase channel_coeffs/residues size wmalosslessdec: increase WMALL_BLOCK_MAX_BITS to 14. lagarith: check count before writing zeros. wmaprodec: check num_vec_coeffs for validity avidec: use actually read size instead of requested size avidec: return 0, not packet size from read_packet(). Conflicts: libavcodec/lagarith.c libavcodec/wmalosslessdec.c libavcodec/wmaprodec.c libavformat/avidec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/lagarith.c5
-rw-r--r--libavcodec/wmalosslessdec.c13
2 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index 09ae402e5c..261e39c21f 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -365,10 +365,11 @@ static int lag_decode_zero_run_line(LagarithContext *l, uint8_t *dst,
output_zeros:
if (l->zeros_rem) {
count = FFMIN(l->zeros_rem, width - i);
- if(end - dst < count) {
- av_log(l->avctx, AV_LOG_ERROR, "too many zeros remaining\n");
+ if (end - dst < count) {
+ av_log(l->avctx, AV_LOG_ERROR, "Too many zeros remaining.\n");
return AVERROR_INVALIDDATA;
}
+
memset(dst, 0, count);
l->zeros_rem -= count;
dst += count;
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 485cab206c..cdd4eb851b 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -23,6 +23,8 @@
*/
#include "libavutil/attributes.h"
+#include "libavutil/avassert.h"
+
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
@@ -38,7 +40,7 @@
#define MAX_ORDER 256
#define WMALL_BLOCK_MIN_BITS 6 ///< log2 of min block size
-#define WMALL_BLOCK_MAX_BITS 12 ///< log2 of max block size
+#define WMALL_BLOCK_MAX_BITS 14 ///< log2 of max block size
#define WMALL_BLOCK_MAX_SIZE (1 << WMALL_BLOCK_MAX_BITS) ///< maximum block size
#define WMALL_BLOCK_SIZES (WMALL_BLOCK_MAX_BITS - WMALL_BLOCK_MIN_BITS + 1) ///< possible block sizes
@@ -213,12 +215,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->len_prefix = s->decode_flags & 0x40;
/* get frame len */
- bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags);
- if (bits > WMALL_BLOCK_MAX_BITS) {
- av_log_missing_feature(avctx, "big-bits block sizes", 1);
- return AVERROR_INVALIDDATA;
- }
- s->samples_per_frame = 1 << bits;
+ s->samples_per_frame = 1 << ff_wma_get_frame_len_bits(avctx->sample_rate,
+ 3, s->decode_flags);
+ av_assert0(s->samples_per_frame <= WMALL_BLOCK_MAX_SIZE);
/* init previous block len */
for (i = 0; i < avctx->channels; i++)