|
|
@ -63,6 +63,7 @@ typedef struct TM2Context { |
|
|
|
AVFrame *pic; |
|
|
|
AVFrame *pic; |
|
|
|
|
|
|
|
|
|
|
|
GetBitContext gb; |
|
|
|
GetBitContext gb; |
|
|
|
|
|
|
|
int error; |
|
|
|
BswapDSPContext bdsp; |
|
|
|
BswapDSPContext bdsp; |
|
|
|
|
|
|
|
|
|
|
|
uint8_t *buffer; |
|
|
|
uint8_t *buffer; |
|
|
@ -398,6 +399,7 @@ static inline int GET_TOK(TM2Context *ctx,int type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (ctx->tok_ptrs[type] >= ctx->tok_lens[type]) { |
|
|
|
if (ctx->tok_ptrs[type] >= ctx->tok_lens[type]) { |
|
|
|
av_log(ctx->avctx, AV_LOG_ERROR, "Read token from stream %i out of bounds (%i>=%i)\n", type, ctx->tok_ptrs[type], ctx->tok_lens[type]); |
|
|
|
av_log(ctx->avctx, AV_LOG_ERROR, "Read token from stream %i out of bounds (%i>=%i)\n", type, ctx->tok_ptrs[type], ctx->tok_lens[type]); |
|
|
|
|
|
|
|
ctx->error = 1; |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
if (type <= TM2_MOT) { |
|
|
|
if (type <= TM2_MOT) { |
|
|
@ -809,6 +811,8 @@ static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p) |
|
|
|
default: |
|
|
|
default: |
|
|
|
av_log(ctx->avctx, AV_LOG_ERROR, "Skipping unknown block type %i\n", type); |
|
|
|
av_log(ctx->avctx, AV_LOG_ERROR, "Skipping unknown block type %i\n", type); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (ctx->error) |
|
|
|
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -889,6 +893,8 @@ static int decode_frame(AVCodecContext *avctx, |
|
|
|
int offset = TM2_HEADER_SIZE; |
|
|
|
int offset = TM2_HEADER_SIZE; |
|
|
|
int i, t, ret; |
|
|
|
int i, t, ret; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
l->error = 0; |
|
|
|
|
|
|
|
|
|
|
|
av_fast_padded_malloc(&l->buffer, &l->buffer_size, buf_size); |
|
|
|
av_fast_padded_malloc(&l->buffer, &l->buffer_size, buf_size); |
|
|
|
if (!l->buffer) { |
|
|
|
if (!l->buffer) { |
|
|
|
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); |
|
|
|
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); |
|
|
|