an integer overflow could cause an assertion failure when freeing memory. (cherry picked from commit 0401e0867b)
0401e0867b