Browse Source

xldec: move buffer size check up, it can be done before allocating a frame

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.11
Michael Niedermayer 13 years ago
parent
commit
8c59e0c362
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      libavcodec/xl.c

+ 5
- 5
libavcodec/xl.c View File

@@ -57,6 +57,11 @@ static int decode_frame(AVCodecContext *avctx,
return AVERROR_INVALIDDATA;
}

if (buf_size < avctx->width * avctx->height) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
return AVERROR_INVALIDDATA;
}

if(p->data[0])
avctx->release_buffer(avctx, p);

@@ -74,11 +79,6 @@ static int decode_frame(AVCodecContext *avctx,

stride = avctx->width - 4;

if (buf_size < avctx->width * avctx->height) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
return AVERROR_INVALIDDATA;
}

for (i = 0; i < avctx->height; i++) {
/* lines are stored in reversed order */
buf += stride;


Loading…
Cancel
Save