Commit 164b67ca authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/vcr1: replace redundant checks from libav...

avcodec/vcr1: replace redundant checks from libav (8aba7968)  by asserts
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 8ba683e6
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
#include "libavutil/avassert.h"
#include "libavutil/internal.h" #include "libavutil/internal.h"
typedef struct VCR1Context { typedef struct VCR1Context {
...@@ -65,9 +66,6 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data, ...@@ -65,9 +66,6 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
p->pict_type = AV_PICTURE_TYPE_I; p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1; p->key_frame = 1;
if (buf_size < 32)
goto packet_small;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
a->delta[i] = *bytestream++; a->delta[i] = *bytestream++;
bytestream++; bytestream++;
...@@ -82,8 +80,7 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data, ...@@ -82,8 +80,7 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
uint8_t *cb = &p->data[1][(y >> 2) * p->linesize[1]]; uint8_t *cb = &p->data[1][(y >> 2) * p->linesize[1]];
uint8_t *cr = &p->data[2][(y >> 2) * p->linesize[2]]; uint8_t *cr = &p->data[2][(y >> 2) * p->linesize[2]];
if (buf_size < 4 + avctx->width) av_assert0 (buf_size >= 4 + avctx->width);
goto packet_small;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
a->offset[i] = *bytestream++; a->offset[i] = *bytestream++;
...@@ -104,8 +101,7 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data, ...@@ -104,8 +101,7 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
buf_size -= 4; buf_size -= 4;
} }
} else { } else {
if (buf_size < avctx->width / 2) av_assert0 (buf_size >= avctx->width / 2);
goto packet_small;
offset = a->offset[y & 3] - a->delta[bytestream[2] & 0xF]; offset = a->offset[y & 3] - a->delta[bytestream[2] & 0xF];
...@@ -128,9 +124,6 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data, ...@@ -128,9 +124,6 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
*got_frame = 1; *got_frame = 1;
return buf_size; return buf_size;
packet_small:
av_log(avctx, AV_LOG_ERROR, "Input packet too small.\n");
return AVERROR_INVALIDDATA;
} }
AVCodec ff_vcr1_decoder = { AVCodec ff_vcr1_decoder = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment