Fix some ASAN-identified problems

Clang under Address sanitizer is showing several problems when building
Perl, having to do when a limit reaches I32_MAX.  This commit fixes
those problems by doing special tests for I32_MAX, and preventing
overflow.