[FFmpeg-devel] [PATCH 1/3] exr: compression attribute is mandatory

Paul B Mahol onemda at gmail.com
Thu Jul 19 20:22:15 CEST 2012


Do not continue decoding if one is missing.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/exr.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index f175706..4945ad7 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -446,6 +446,11 @@ static int decode_frame(AVCodecContext *avctx,
         }
     }
 
+    if (s->compr == -1) {
+        av_log(avctx, AV_LOG_ERROR, "Missing compression attribute\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (buf >= buf_end) {
         av_log(avctx, AV_LOG_ERROR, "Incomplete frame\n");
         return AVERROR_INVALIDDATA;
@@ -642,6 +647,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
     avcodec_get_frame_defaults(&s->picture);
     avctx->coded_frame = &s->picture;
 
+    s->compr = -1;
+
     return 0;
 }
 
-- 
1.7.7



More information about the ffmpeg-devel mailing list