Commit b96dc093 authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 8672fc7b 065b3a1c
...@@ -365,10 +365,11 @@ static int lag_decode_zero_run_line(LagarithContext *l, uint8_t *dst, ...@@ -365,10 +365,11 @@ static int lag_decode_zero_run_line(LagarithContext *l, uint8_t *dst,
output_zeros: output_zeros:
if (l->zeros_rem) { if (l->zeros_rem) {
count = FFMIN(l->zeros_rem, width - i); count = FFMIN(l->zeros_rem, width - i);
if(end - dst < count) { if (end - dst < count) {
av_log(l->avctx, AV_LOG_ERROR, "too many zeros remaining\n"); av_log(l->avctx, AV_LOG_ERROR, "Too many zeros remaining.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
memset(dst, 0, count); memset(dst, 0, count);
l->zeros_rem -= count; l->zeros_rem -= count;
dst += count; dst += count;
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
*/ */
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
#include "get_bits.h" #include "get_bits.h"
...@@ -38,7 +40,7 @@ ...@@ -38,7 +40,7 @@
#define MAX_ORDER 256 #define MAX_ORDER 256
#define WMALL_BLOCK_MIN_BITS 6 ///< log2 of min block size #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_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 #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) ...@@ -213,12 +215,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->len_prefix = s->decode_flags & 0x40; s->len_prefix = s->decode_flags & 0x40;
/* get frame len */ /* get frame len */
bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags); s->samples_per_frame = 1 << ff_wma_get_frame_len_bits(avctx->sample_rate,
if (bits > WMALL_BLOCK_MAX_BITS) { 3, s->decode_flags);
av_log_missing_feature(avctx, "big-bits block sizes", 1); av_assert0(s->samples_per_frame <= WMALL_BLOCK_MAX_SIZE);
return AVERROR_INVALIDDATA;
}
s->samples_per_frame = 1 << bits;
/* init previous block len */ /* init previous block len */
for (i = 0; i < avctx->channels; i++) for (i = 0; i < avctx->channels; i++)
......
...@@ -1205,7 +1205,7 @@ resync: ...@@ -1205,7 +1205,7 @@ resync:
} }
ast->frame_offset += get_duration(ast, pkt->size); ast->frame_offset += get_duration(ast, pkt->size);
} }
ast->remaining -= size; ast->remaining -= err;
if(!ast->remaining){ if(!ast->remaining){
avi->stream_index= -1; avi->stream_index= -1;
ast->packet_size= 0; ast->packet_size= 0;
...@@ -1227,7 +1227,7 @@ resync: ...@@ -1227,7 +1227,7 @@ resync:
avi->dts_max = dts; avi->dts_max = dts;
} }
return size; return 0;
} }
if ((err = avi_sync(s, 0)) < 0) if ((err = avi_sync(s, 0)) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment