diff options
author | George Greer <perl@greerga.m-l.org> | 2013-03-11 21:39:13 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-03-12 16:06:47 -0600 |
commit | 9b139d09af7013f395939ac80e537edd55bb404a (patch) | |
tree | 1b56effbb030753d7f0b64115f1434e7169b908f /scope.c | |
parent | 46391258eca955edb5120d04f4c8fc6a1b087124 (diff) | |
download | perl-9b139d09af7013f395939ac80e537edd55bb404a.tar.gz |
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.
Diffstat (limited to 'scope.c')
-rw-r--r-- | scope.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -394,7 +394,7 @@ Perl_save_int(pTHX_ int *intp) { dVAR; const int i = *intp; - UV type = ((UV)(i << SAVE_TIGHT_SHIFT) | SAVEt_INT_SMALL); + UV type = ((UV)((UV)i << SAVE_TIGHT_SHIFT) | SAVEt_INT_SMALL); int size = 2; dSS_ADD; @@ -441,7 +441,7 @@ Perl_save_I32(pTHX_ I32 *intp) { dVAR; const I32 i = *intp; - UV type = ((I32)(i << SAVE_TIGHT_SHIFT) | SAVEt_I32_SMALL); + UV type = ((I32)((U32)i << SAVE_TIGHT_SHIFT) | SAVEt_I32_SMALL); int size = 2; dSS_ADD; |