Revision e7e578b7

View differences:

libavcodec/rv10.c
520 520
}
521 521

  
522 522
static int rv10_decode_packet(AVCodecContext *avctx,
523
                             const uint8_t *buf, int buf_size)
523
                             const uint8_t *buf, int buf_size, int buf_size2)
524 524
{
525 525
    MpegEncContext *s = avctx->priv_data;
526 526
    int mb_count, mb_pos, left, start_mb_x;
......
603 603
        s->mv_type = MV_TYPE_16X16;
604 604
        ret=ff_h263_decode_mb(s, s->block);
605 605

  
606
        if (ret != SLICE_ERROR && s->gb.size_in_bits < get_bits_count(&s->gb) && 8*buf_size2 >= get_bits_count(&s->gb)){
607
            av_log(avctx, AV_LOG_DEBUG, "update size from %d to %d\n", s->gb.size_in_bits, 8*buf_size2);
608
            s->gb.size_in_bits= 8*buf_size2;
609
            ret= SLICE_OK;
610
        }
611

  
606 612
        if (ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb)) {
607 613
            av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
608 614
            return -1;
......
625 631

  
626 632
    ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
627 633

  
628
    return buf_size;
634
    return s->gb.size_in_bits;
629 635
}
630 636

  
631 637
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
......
662 668

  
663 669
    for(i=0; i<slice_count; i++){
664 670
        int offset= get_slice_offset(avctx, slices_hdr, i);
665
        int size;
671
        int size, size2;
666 672

  
667 673
        if(i+1 == slice_count)
668 674
            size= buf_size - offset;
669 675
        else
670 676
            size= get_slice_offset(avctx, slices_hdr, i+1) - offset;
671 677

  
672
        rv10_decode_packet(avctx, buf+offset, size);
678
        if(i+2 >= slice_count)
679
            size2= buf_size - offset;
680
        else
681
            size2= get_slice_offset(avctx, slices_hdr, i+2) - offset;
682

  
683
        if(rv10_decode_packet(avctx, buf+offset, size, size2) > 8*size)
684
            i++;
673 685
    }
674 686

  
675 687
    if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){

Also available in: Unified diff