Browse Source

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>
tags/n1.1
Michael Niedermayer 12 years ago
parent
commit
b96dc093ea
3 changed files with 11 additions and 11 deletions
  1. +3
    -2
      libavcodec/lagarith.c
  2. +6
    -7
      libavcodec/wmalosslessdec.c
  3. +2
    -2
      libavformat/avidec.c

+ 3
- 2
libavcodec/lagarith.c View File

@@ -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) {
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; return AVERROR_INVALIDDATA;
} }

memset(dst, 0, count); memset(dst, 0, count);
l->zeros_rem -= count; l->zeros_rem -= count;
dst += count; dst += count;


+ 6
- 7
libavcodec/wmalosslessdec.c View File

@@ -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 @@
#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)
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);
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 */ /* init previous block len */
for (i = 0; i < avctx->channels; i++) for (i = 0; i < avctx->channels; i++)


+ 2
- 2
libavformat/avidec.c View File

@@ -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:
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)


Loading…
Cancel
Save