summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorTomasz Konojacki <me@xenu.pl>2019-10-29 16:31:19 +0100
committerTony Cook <tony@develop-help.com>2019-10-30 15:11:55 +1100
commitd398c6bff9ffeadd64017079aea6fd0967884bf4 (patch)
treed7c590f5e81826446f28259a4f93a991d66bc6ea /pp.c
parent3f2416aea024cc4d3e0b0ffbe0e292a0d9970b8d (diff)
downloadperl-d398c6bff9ffeadd64017079aea6fd0967884bf4.tar.gz
use PTR2nat() instead of casting pointers to unsigned long
Casting a pointer to unsigned long will result in truncation when sizeof(void*) > sizeof(unsigned long) [gh #17232]
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index d9a7cc3d09..bc08a0eed6 100644
--- a/pp.c
+++ b/pp.c
@@ -2552,7 +2552,7 @@ S_scomplement(pTHX_ SV *targ, SV *sv)
#ifdef LIBERAL
{
long *tmpl;
- for ( ; anum && (unsigned long)tmps % sizeof(long); anum--, tmps++)
+ for ( ; anum && PTR2nat(tmps) % sizeof(long); anum--, tmps++)
*tmps = ~*tmps;
tmpl = (long*)tmps;
for ( ; anum >= (I32)sizeof(long); anum -= (I32)sizeof(long), tmpl++)