changeset 5656:3f7d66453c2e libavcodec

Fix extreme stupidity: buffer size check must of course be before buffer use!
author reimar
date Sun, 09 Sep 2007 09:00:12 +0000
parents 711922c1e9e7
children ec46684cc8ad
files nuv.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nuv.c	Sun Sep 09 08:52:53 2007 +0000
+++ b/nuv.c	Sun Sep 09 09:00:12 2007 +0000
@@ -156,12 +156,12 @@
         buf_size = c->decomp_size;
     }
     if (c->codec_frameheader) {
-        get_quant_quality(c, buf[10]);
-        rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
         if (buf_size < 12) {
             av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
             return -1;
         }
+        get_quant_quality(c, buf[10]);
+        rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
         buf = &buf[12];
         buf_size -= 12;
     }