Skip to content

Commit ccf9f05

Browse files
authored
Merge pull request google#198 from Shivam7-1/patch-2
Multiplication result converted to larger type (Mitigate Arithmetic Overflow in Memory Allocation)
2 parents 831773b + 55bdd96 commit ccf9f05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/zopflipng/lodepng/lodepng_util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ unsigned convertToXYZ(float* out, float whitepoint[3], const unsigned char* in,
11511151
use_icc = validateICC(&icc);
11521152
}
11531153

1154-
data = (unsigned char*)lodepng_malloc(w * h * (bit16 ? 8 : 4));
1154+
data = (unsigned char*)lodepng_malloc((size_t)w * (size_t)h * (bit16 ? 8 : 4));
11551155
error = lodepng_convert(data, in, &tempmode, mode_in, w, h);
11561156
if(error) goto cleanup;
11571157

0 commit comments

Comments
 (0)