From 29a58ad87cf9bd5f35019e7bd0b3b8e5da551c1d Mon Sep 17 00:00:00 2001 From: Kimball Thurston Date: Sat, 16 Oct 2021 14:23:50 +1300 Subject: [PATCH] Require at least one channel (#1182) When we started core, there was a thought to allow an empty image to enable a metadata part. However, this needs wider support and causes regressions from the existing c++ behavior Signed-off-by: Kimball Thurston --- src/lib/OpenEXRCore/validation.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/OpenEXRCore/validation.c b/src/lib/OpenEXRCore/validation.c index 701cbcfbcd..8257b83d22 100644 --- a/src/lib/OpenEXRCore/validation.c +++ b/src/lib/OpenEXRCore/validation.c @@ -182,6 +182,12 @@ validate_channels ( EXR_ERR_NO_ATTR_BY_NAME, "request to validate channel list, but data window not set to validate against"); + if (channels->num_channels <= 0) + return f->report_error ( + f, + EXR_ERR_FILE_BAD_HEADER, + "At least one channel required"); + dw = curpart->data_window; w = dw.max.x - dw.min.x + 1; h = dw.max.y - dw.min.y + 1;