Avoid integer overflows in DWT. Fixes https://bugs.chromium.org/p/oss-fuzz/issues...
[openjpeg.git] / src / lib / openjp2 / mct.c
index 88c8f40920bb834ac286ed207046a201fc7893d2..7805812801a9912d519e9280a1c2f8a6c03682aa 100644 (file)
@@ -457,7 +457,7 @@ void opj_calculate_norms(OPJ_FLOAT64 * pNorms,
         for (j = 0; j < pNbComps; ++j) {
             lCurrentValue = lMatrix[lIndex];
             lIndex += pNbComps;
-            lNorms[i] += lCurrentValue * lCurrentValue;
+            lNorms[i] += (OPJ_FLOAT64) lCurrentValue * lCurrentValue;
         }
         lNorms[i] = sqrt(lNorms[i]);
     }