|
|
@ -550,7 +550,7 @@ static av_cold int rv10_decode_end(AVCodecContext *avctx) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, |
|
|
|
static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, |
|
|
|
int buf_size, int buf_size2) |
|
|
|
int buf_size, int buf_size2, int whole_size) |
|
|
|
{ |
|
|
|
{ |
|
|
|
RVDecContext *rv = avctx->priv_data; |
|
|
|
RVDecContext *rv = avctx->priv_data; |
|
|
|
MpegEncContext *s = &rv->m; |
|
|
|
MpegEncContext *s = &rv->m; |
|
|
@ -580,6 +580,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (whole_size < s->mb_width * s->mb_height / 8) |
|
|
|
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
|
|
|
|
|
|
|
if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) { |
|
|
|
if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) { |
|
|
|
// FIXME write parser so we always have complete frames?
|
|
|
|
// FIXME write parser so we always have complete frames?
|
|
|
|
if (s->current_picture_ptr) { |
|
|
|
if (s->current_picture_ptr) { |
|
|
@ -754,7 +757,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, |
|
|
|
offset + FFMAX(size, size2) > buf_size) |
|
|
|
offset + FFMAX(size, size2) > buf_size) |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
|
|
|
|
|
|
|
if ((ret = rv10_decode_packet(avctx, buf + offset, size, size2)) < 0) |
|
|
|
if ((ret = rv10_decode_packet(avctx, buf + offset, size, size2, buf_size)) < 0) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
|
|
if (ret > 8 * size) |
|
|
|
if (ret > 8 * size) |
|
|
|