[FFmpeg-cvslog] xldec: move buffer size check up, it can be done before allocating a frame
Michael Niedermayer
git at videolan.org
Sat Apr 21 21:57:41 CEST 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Apr 21 21:30:51 2012 +0200| [8c59e0c362b948a746392b65932dd1cfeab8076c] | committer: Michael Niedermayer
xldec: move buffer size check up, it can be done before allocating a frame
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c59e0c362b948a746392b65932dd1cfeab8076c
---
libavcodec/xl.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavcodec/xl.c b/libavcodec/xl.c
index c8b0e06..0c85e22 100644
--- a/libavcodec/xl.c
+++ b/libavcodec/xl.c
@@ -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;
More information about the ffmpeg-cvslog
mailing list