[FFmpeg-cvslog] avcodec/exr: fix crash caused by merge

Paul B Mahol git at videolan.org
Fri Jun 19 11:35:44 CEST 2015


ffmpeg | branch: release/2.3 | Paul B Mahol <onemda at gmail.com> | Sat Jun  6 15:56:06 2015 +0000| [17d9157c8229af384b7e1377a6aa7f414e2a79f0] | committer: Carl Eugen Hoyos

avcodec/exr: fix crash caused by merge

Various header informations need to be reset when decoding next frame.
Regression since: 95582b5c

Fixes ticket #4597.
Signed-off-by: Paul B Mahol <onemda at gmail.com>
(cherry picked from commit a03b69478b7f1c0c31e53acb0cf392917c0f967a)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=17d9157c8229af384b7e1377a6aa7f414e2a79f0
---

 libavcodec/exr.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 62e8521..ff2d7b0 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1011,6 +1011,22 @@ static int decode_header(EXRContext *s)
     int current_channel_offset = 0;
     int magic_number, version, flags, i;
 
+    s->xmin               = ~0;
+    s->xmax               = ~0;
+    s->ymin               = ~0;
+    s->ymax               = ~0;
+    s->xdelta             = ~0;
+    s->ydelta             = ~0;
+    s->channel_offsets[0] = -1;
+    s->channel_offsets[1] = -1;
+    s->channel_offsets[2] = -1;
+    s->channel_offsets[3] = -1;
+    s->pixel_type         = EXR_UNKNOWN;
+    s->compression        = EXR_UNKN;
+    s->nb_channels        = 0;
+    s->w                  = 0;
+    s->h                  = 0;
+
     if (bytestream2_get_bytes_left(&s->gb) < 10) {
         av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n");
         return AVERROR_INVALIDDATA;
@@ -1351,21 +1367,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
     float one_gamma = 1.0f / s->gamma;
 
     s->avctx              = avctx;
-    s->xmin               = ~0;
-    s->xmax               = ~0;
-    s->ymin               = ~0;
-    s->ymax               = ~0;
-    s->xdelta             = ~0;
-    s->ydelta             = ~0;
-    s->channel_offsets[0] = -1;
-    s->channel_offsets[1] = -1;
-    s->channel_offsets[2] = -1;
-    s->channel_offsets[3] = -1;
-    s->pixel_type         = EXR_UNKNOWN;
-    s->compression        = EXR_UNKN;
-    s->nb_channels        = 0;
-    s->w                  = 0;
-    s->h                  = 0;
 
     if ( one_gamma > 0.9999f && one_gamma < 1.0001f ) {
         for ( i = 0; i < 65536; ++i ) {



More information about the ffmpeg-cvslog mailing list