# HG changeset patch # User kostya # Date 1234003611 0 # Node ID f471abd09fef2af3effb8ace48a003fd3346d049 # Parent 64acd0cc269d52a8e352dc8b7f7807ebc97cb550 Move RV3/4 frame type check up so 1-slice unanchored B-frames are checked, too. diff -r 64acd0cc269d -r f471abd09fef rv34.c --- a/rv34.c Sat Feb 07 09:35:16 2009 +0000 +++ b/rv34.c Sat Feb 07 10:46:51 2009 +0000 @@ -1396,6 +1396,19 @@ }else slice_count = avctx->slice_count; + //parse first slice header to check whether this frame can be decoded + if(get_slice_offset(avctx, slices_hdr, 0) > buf_size){ + av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n"); + return -1; + } + init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), buf_size-get_slice_offset(avctx, slices_hdr, 0)); + if(r->parse_slice_header(r, &r->s.gb, &si) < 0){ + av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n"); + return -1; + } + if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE) + return -1; + for(i=0; isi.end = si.start; } - if(!i && si.type == FF_B_TYPE && (!s->last_picture_ptr || !s->last_picture_ptr->data[0])) - return -1; last = rv34_decode_slice(r, r->si.end, buf + offset, size); s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(last)