[FFmpeg-cvslog] avcodec/exr: correctly calculate display window

Paul B Mahol git at videolan.org
Tue Feb 16 14:59:25 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Feb 16 13:42:36 2021 +0100| [3ea660c78aade07d2616b2e1024a888780eb3a83] | committer: Paul B Mahol

avcodec/exr: correctly calculate display window

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

 libavcodec/exr.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 7d46e8e027..2b57efb0d2 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1604,14 +1604,20 @@ static int decode_header(EXRContext *s, AVFrame *frame)
             continue;
         } else if ((var_size = check_header_variable(s, "displayWindow",
                                                      "box2i", 34)) >= 0) {
+            int32_t sx, sy, dx, dy;
+
             if (!var_size) {
                 ret = AVERROR_INVALIDDATA;
                 goto fail;
             }
 
-            bytestream2_skip(&s->gb, 8);
-            s->w = bytestream2_get_le32(&s->gb) + 1;
-            s->h = bytestream2_get_le32(&s->gb) + 1;
+            sx = bytestream2_get_le32(&s->gb);
+            sy = bytestream2_get_le32(&s->gb);
+            dx = bytestream2_get_le32(&s->gb);
+            dy = bytestream2_get_le32(&s->gb);
+
+            s->w = dx - sx + 1;
+            s->h = dy - sy + 1;
 
             continue;
         } else if ((var_size = check_header_variable(s, "lineOrder",



More information about the ffmpeg-cvslog mailing list