~ubuntu-branches/ubuntu/raring/libav/raring-security

« back to all changes in this revision

Viewing changes to libavcodec/rv34.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2011-09-28 09:18:34 UTC
  • mfrom: (1.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20110928091834-w415mnuh06h4zpvc
Tags: 4:0.7.1-7ubuntu2
Revert "Convert package to include multiarch support."

Show diffs side-by-side

added added

removed removed

Lines of Context:
1436
1436
        slice_count = (*buf++) + 1;
1437
1437
        slices_hdr = buf + 4;
1438
1438
        buf += 8 * slice_count;
 
1439
        buf_size -= 1 + 8 * slice_count;
1439
1440
    }else
1440
1441
        slice_count = avctx->slice_count;
1441
1442
 
1442
1443
    //parse first slice header to check whether this frame can be decoded
1443
 
    if(get_slice_offset(avctx, slices_hdr, 0) > buf_size){
1444
 
        av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
 
1444
    if(get_slice_offset(avctx, slices_hdr, 0) < 0 ||
 
1445
       get_slice_offset(avctx, slices_hdr, 0) > buf_size){
 
1446
        av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
1445
1447
        return -1;
1446
1448
    }
1447
 
    init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), buf_size-get_slice_offset(avctx, slices_hdr, 0));
 
1449
    init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), (buf_size-get_slice_offset(avctx, slices_hdr, 0))*8);
1448
1450
    if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){
1449
1451
        av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
1450
1452
        return -1;
1454
1456
    if(   (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B)
1455
1457
       || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I)
1456
1458
       ||  avctx->skip_frame >= AVDISCARD_ALL)
1457
 
        return buf_size;
 
1459
        return avpkt->size;
1458
1460
 
1459
1461
    for(i=0; i<slice_count; i++){
1460
1462
        int offset= get_slice_offset(avctx, slices_hdr, i);
1464
1466
        else
1465
1467
            size= get_slice_offset(avctx, slices_hdr, i+1) - offset;
1466
1468
 
1467
 
        if(offset > buf_size){
1468
 
            av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
 
1469
        if(offset < 0 || offset > buf_size || size < 0){
 
1470
            av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
1469
1471
            break;
1470
1472
        }
1471
1473
 
1486
1488
            break;
1487
1489
    }
1488
1490
 
1489
 
    if(last){
 
1491
    if(last && s->current_picture_ptr){
1490
1492
        if(r->loop_filter)
1491
1493
            r->loop_filter(r, s->mb_height - 1);
1492
1494
        ff_er_frame_end(s);
1503
1505
        }
1504
1506
        s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...)
1505
1507
    }
1506
 
    return buf_size;
 
1508
    return avpkt->size;
1507
1509
}
1508
1510
 
1509
1511
av_cold int ff_rv34_decode_end(AVCodecContext *avctx)