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 <michael@niedermayer.cc>
(cherry picked from commit 0469d68acb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2025-08-09 14:05:19 +02:00
parent 2f1fc996ec
commit a2e8dc01c0

View File

@@ -2064,6 +2064,16 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
for (int i = 0; i < 4; i++)
s->channel_offsets[i] *= 2;
}
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_FLOAT: