summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-08-17 08:25:50 +0100
committerDavid Mitchell <davem@iabyn.com>2017-08-17 08:27:36 +0100
commitf649c622bbf0c42d2c847fc7704db9c435527e3f (patch)
treee0004ee94067d9c9097c3dd322494cdfcd366403 /dump.c
parent36000cd1c47863d8412b285701db7232dd450239 (diff)
downloadperl-f649c622bbf0c42d2c847fc7704db9c435527e3f.tar.gz
S_opdump_indent(): avoid shift overflow
RT #131912 the (1 << i) is harmless for large i, but triggers an 'undefined-behavior' errror in clang. So work around it.
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/dump.c b/dump.c
index 1fa242204e..1628ca398c 100644
--- a/dump.c
+++ b/dump.c
@@ -578,7 +578,10 @@ S_opdump_indent(pTHX_ const OP *o, I32 level, UV bar, PerlIO *file,
/* output preceding blank line */
PerlIO_puts(file, " ");
for (i = level-1; i >= 0; i--)
- PerlIO_puts(file, i == 0 || (bar & (1 << i)) ? "| " : " ");
+ PerlIO_puts(file, ( i == 0
+ || (i < UVSIZE*8 && (bar & ((UV)1 << i)))
+ )
+ ? "| " : " ");
PerlIO_puts(file, "\n");
/* output sequence number */