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>
This commit is contained in:
Michael Niedermayer 2025-08-09 14:05:19 +02:00
parent 069201c535
commit 0469d68acb
No known key found for this signature in database
GPG key ID: B18E8928B3948D64

View file

@ -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) {