exr: make sure that data_size is not bigger than expected
authorPaul B Mahol <onemda@gmail.com>
Sun, 24 Feb 2013 14:10:20 +0000 (14:10 +0000)
committerPaul B Mahol <onemda@gmail.com>
Sun, 24 Feb 2013 14:27:39 +0000 (14:27 +0000)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/exr.c

index 59144a2..cef5e0c 100644 (file)
@@ -270,7 +270,8 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
     uncompressed_size = s->scan_line_size * FFMIN(s->scan_lines_per_block, s->ymax - line + 1);
     if ((s->compr == EXR_RAW && (data_size != uncompressed_size ||
                                  line_offset > buf_size - uncompressed_size)) ||
-        (s->compr != EXR_RAW && line_offset > buf_size - data_size)) {
+        (s->compr != EXR_RAW && (data_size > uncompressed_size ||
+                                 line_offset > buf_size - data_size))) {
         return AVERROR_INVALIDDATA;
     }