avcodec/diracdec: Move buf[] read after size check
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 5 May 2015 20:01:58 +0000 (22:01 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 5 May 2015 20:01:58 +0000 (22:01 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/diracdec.c

index 0453a97..4230a06 100644 (file)
@@ -1815,12 +1815,14 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
 {
     DiracContext *s   = avctx->priv_data;
     DiracFrame *pic   = NULL;
-    int ret, i, parse_code = buf[4];
+    int ret, i, parse_code;
     unsigned tmp;
 
     if (size < DATA_UNIT_HEADER_SIZE)
         return -1;
 
+    parse_code = buf[4];
+
     init_get_bits(&s->gb, &buf[13], 8*(size - DATA_UNIT_HEADER_SIZE));
 
     if (parse_code == pc_seq_header) {