PR #20194 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20194
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20194.patch

Fixes: out of array access
Fixes: BIGSLEEP-436511754/testcase.exr

Found-by: Google Big Sleep
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>


>From 3008d30f9885fc22b1cba63d8770820872c49fc9 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <mich...@niedermayer.cc>
Date: Sat, 9 Aug 2025 14:05:19 +0200
Subject: [PATCH] avcodec/exr: Check for pixel type consistency in DWA

Fixes: out of array access
Fixes: BIGSLEEP-436511754/testcase.exr

Found-by: Google Big Sleep
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
---
 libavcodec/exr.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index dea612a42b..67f971ff35 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -2086,6 +2086,17 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*picture,
     if ((ret = decode_header(s, picture)) < 0)
         return ret;
 
+    if (s->compression == EXR_DWAA ||
+        s->compression == EXR_DWAB) {
+        for (int i = 0; i<s->nb_channels; i++) {
+            EXRChannel *channel = &s->channels[i];
+            if (channel->pixel_type != s->pixel_type) {
+                avpriv_request_sample(s->avctx, "mixed pixel type DWA");
+                return AVERROR_PATCHWELCOME;
+            }
+        }
+    }
+
     switch (s->pixel_type) {
     case EXR_HALF:
         if (s->channel_offsets[3] >= 0) {
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to