[FFmpeg-cvslog] loco: Fix error handling.
Michael Niedermayer
git at videolan.org
Thu Nov 24 15:47:06 CET 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 24 15:39:41 2011 +0100| [2bf09826c170b0f474f1cd92a138acd8109eef8b] | committer: Michael Niedermayer
loco: Fix error handling.
Fixes null pointer dereference / http://www.google-melange.com/gci/task/view/google/gci2011/7120335
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2bf09826c170b0f474f1cd92a138acd8109eef8b
---
libavcodec/loco.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/libavcodec/loco.c b/libavcodec/loco.c
index 505f566..75701e9 100644
--- a/libavcodec/loco.c
+++ b/libavcodec/loco.c
@@ -123,6 +123,9 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
int val;
int i, j;
+ if(buf_size<=0)
+ return -1;
+
init_get_bits(&rc.gb, buf, buf_size*8);
rc.save = 0;
rc.run = 0;
@@ -225,7 +228,7 @@ static int decode_frame(AVCodecContext *avctx,
*data_size = sizeof(AVFrame);
*(AVFrame*)data = l->pic;
- return buf_size;
+ return buf_size < 0 ? -1 : buf_size;
}
static av_cold int decode_init(AVCodecContext *avctx){
More information about the ffmpeg-cvslog
mailing list