summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-05-29 10:01:13 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-05-29 10:03:26 -0400
commite7aca353f7af5d2dbed5f0e55c23d87f17c2406c (patch)
tree7284cea4904f804adfa84accdef68699b614dd1a /doop.c
parente5a8a0fbd70ee31a016b7cf1c4b8c07839c6cf97 (diff)
downloadperl-e7aca353f7af5d2dbed5f0e55c23d87f17c2406c.tar.gz
UV casting to avoid intermediate sign extension.
[perl #121746] Fix for Coverity perl5 CIDs 29069, 29070, 29071: Unintended sign extension: ... ... if ... U8 (8 bits unsigned) ... 32 bits, signed ... 64 bits, unsigned ... is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/doop.c b/doop.c
index 96185bd79d..0ba4bb8304 100644
--- a/doop.c
+++ b/doop.c
@@ -850,7 +850,7 @@ Perl_do_vecget(pTHX_ SV *sv, SSize_t offset, int size)
((UV) s[uoffset + 1] << 48) +
((UV) s[uoffset + 2] << 40) +
((UV) s[uoffset + 3] << 32) +
- ( s[uoffset + 4] << 24);
+ ((UV) s[uoffset + 4] << 24);
else if (uoffset + 6 >= srclen)
retnum =
((UV) s[uoffset ] << 56) +
@@ -867,7 +867,7 @@ Perl_do_vecget(pTHX_ SV *sv, SSize_t offset, int size)
((UV) s[uoffset + 3] << 32) +
((UV) s[uoffset + 4] << 24) +
((UV) s[uoffset + 5] << 16) +
- ( s[uoffset + 6] << 8);
+ ((UV) s[uoffset + 6] << 8);
}
#endif
}