mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-02 03:06:28 +02:00
avcodec/bethsoftvideo: Check block_type before frame alloc
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
e1c0239d5a
commit
d93dccdc9f
@ -79,6 +79,11 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
int code, ret;
|
||||
int yoffset;
|
||||
|
||||
bytestream2_init(&vid->g, avpkt->data, avpkt->size);
|
||||
block_type = bytestream2_get_byte(&vid->g);
|
||||
if (block_type < 1 || block_type > 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, vid->frame, 0)) < 0)
|
||||
return ret;
|
||||
wrap_to_next_line = vid->frame->linesize[0] - avctx->width;
|
||||
@ -92,11 +97,10 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
return ret;
|
||||
}
|
||||
|
||||
bytestream2_init(&vid->g, avpkt->data, avpkt->size);
|
||||
dst = vid->frame->data[0];
|
||||
frame_end = vid->frame->data[0] + vid->frame->linesize[0] * avctx->height;
|
||||
|
||||
switch(block_type = bytestream2_get_byte(&vid->g)){
|
||||
switch(block_type){
|
||||
case PALETTE_BLOCK: {
|
||||
*got_frame = 0;
|
||||
if ((ret = set_palette(vid, &vid->g)) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user