File openexr-CVE-2021-20300.patch of Package openexr.20697
diff --git a/OpenEXR/IlmImf/ImfHuf.cpp b/OpenEXR/IlmImf/ImfHuf.cpp index 7bd7fc00d..23cfcfd6c 100644 --- a/IlmImf/ImfHuf.cpp +++ b/IlmImf/ImfHuf.cpp @@ -1093,7 +1093,9 @@ hufUncompress (const char compressed[], const char *ptr = compressed + 20; - if ( ptr + (nBits+7 )/8 > compressed+nCompressed) + uint64_t nBytes = (static_cast<uint64_t>(nBits)+7) / 8 ; + + if ( ptr + nBytes > compressed+nCompressed) { notEnoughData(); return;