diff --git a/src/jpegxl.imageio/jxlinput.cpp b/src/jpegxl.imageio/jxlinput.cpp index 88f2ccea06..a734d70f71 100644 --- a/src/jpegxl.imageio/jxlinput.cpp +++ b/src/jpegxl.imageio/jxlinput.cpp @@ -360,6 +360,10 @@ JxlInput::open(const std::string& name, ImageSpec& newspec) m_spec = ImageSpec(info.xsize, info.ysize, m_channels, m_data_type); + if (!check_open(m_spec, + { 0, (1 << 30) - 1, 0, (1 << 30) - 1, 0, 1, 0, 4099 })) + return false; + // Read ICC profile if (m_icc_profile.size() && m_icc_profile.data()) { m_spec.attribute("ICCProfile", diff --git a/src/webp.imageio/webpinput.cpp b/src/webp.imageio/webpinput.cpp index 1277a2f3a7..86eb80f55c 100644 --- a/src/webp.imageio/webpinput.cpp +++ b/src/webp.imageio/webpinput.cpp @@ -233,6 +233,9 @@ WebpInput::open(const std::string& name, ImageSpec& spec, m_spec.attribute("oiio:UnassociatedAlpha", 1); } + if (!check_open(m_spec, { 0, (1 << 14) - 1, 0, (1 << 14) - 1, 0, 1, 0, 4 })) + return false; + seek_subimage(0, 0); spec = m_spec; return true;