summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorGeorge Greer <perl@greerga.m-l.org>2013-03-11 21:39:13 -0600
committerKarl Williamson <public@khwilliamson.com>2013-03-12 16:06:47 -0600
commit9b139d09af7013f395939ac80e537edd55bb404a (patch)
tree1b56effbb030753d7f0b64115f1434e7169b908f /scope.c
parent46391258eca955edb5120d04f4c8fc6a1b087124 (diff)
downloadperl-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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scope.c b/scope.c
index 3d62918772..4f9d771f95 100644
--- a/scope.c
+++ b/scope.c
@@ -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;