huff.val_bits, huff.max_bits);
return -1;
}
- if((huff.nodes < 0) || (huff.nodes > 0x10000)) {
+ if((huff.nodes <= 0) || (huff.nodes > 0x10000)) {
av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes);
return -1;
}
{
av_free(code->recode);
if(code->vlc.table)
- free_vlc(&code->vlc);
+ ff_free_vlc(&code->vlc);
}
static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code)
len = AV_RB32(buf); buf += 4; cur += 4;
}
if(len > 0) {
+ if (skip <= cur)
+ return -1;
init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
if(tm2_read_deltas(ctx, stream_id) == -1)
return -1;
buf += 4; cur += 4;
buf += 4; cur += 4; /* unused by decoder */
+ if (skip <= cur)
+ return -1;
init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
if(tm2_build_huff_table(ctx, &codes) == -1)
return -1;
ctx->tok_lens[stream_id] = toks;
len = AV_RB32(buf); buf += 4; cur += 4;
if(len > 0) {
+ if (skip <= cur)
+ return -1;
init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
for(i = 0; i < toks; i++) {
if (get_bits_left(&ctx->gb) <= 0) {
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
TM2Context * const l = avctx->priv_data;
- AVFrame * const p= (AVFrame*)&l->pic;
+ AVFrame * const p = &l->pic;
int i, skip, t;
uint8_t *swbuf;
l->pic.data[0]=NULL;
avctx->pix_fmt = PIX_FMT_BGR24;
- dsputil_init(&l->dsp, avctx);
+ ff_dsputil_init(&l->dsp, avctx);
l->last = av_malloc(4 * sizeof(int) * (avctx->width >> 2));
l->clast = av_malloc(4 * sizeof(int) * (avctx->width >> 2));