Fix Issue 8301 - Access violation when a big array is allocated

Check that adding array padding doesn't cause overflow
Merge pull request #673 from yebblies/issue8301

Issue 8301 - Access violation when a big array is allocated