From ea3cbf49425b3b5e2bc8d1ffbe4bb8bad3328185 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 14 Jun 2023 17:06:48 +0200 Subject: [PATCH] Fix #108980: OpenEXR channels with unknown channel names fail to load The example EXR is non-standard, but we may as well load the data anyway even if we don't know the type of channels. --- .../imbuf/intern/openexr/openexr_api.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 3d2f3fb6869..0a3924e00b5 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1516,8 +1516,6 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa echan->chan_id = BLI_toupper_ascii(channelname[0]); } else if (len > 1) { - bool ok = false; - if (len == 2) { /* Some multi-layers are using two-letter channels name, * like, MX or NZ, which is basically has structure of @@ -1530,33 +1528,28 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa const char chan_id = BLI_toupper_ascii(channelname[1]); if (ELEM(chan_id, 'X', 'Y', 'Z', 'R', 'G', 'B', 'U', 'V', 'A')) { echan->chan_id = chan_id; - ok = true; + } + else { + echan->chan_id = 'X'; /* Default to X if unknown. */ } } else if (BLI_strcaseeq(channelname, "red")) { echan->chan_id = 'R'; - ok = true; } else if (BLI_strcaseeq(channelname, "green")) { echan->chan_id = 'G'; - ok = true; } else if (BLI_strcaseeq(channelname, "blue")) { echan->chan_id = 'B'; - ok = true; } else if (BLI_strcaseeq(channelname, "alpha")) { echan->chan_id = 'A'; - ok = true; } else if (BLI_strcaseeq(channelname, "depth")) { echan->chan_id = 'Z'; - ok = true; } - - if (ok == false) { - printf("multilayer read: unknown channel token: %s\n", channelname); - return 0; + else { + echan->chan_id = 'X'; /* Default to X if unknown. */ } } end -= len + 1; /* +1 to skip '.' separator */