diff options
author | Zefram <zefram@fysh.org> | 2017-12-06 01:40:43 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-06 01:40:43 +0000 |
commit | 7c6e7cf06853eef1d1b271077c402c5f8655fbe6 (patch) | |
tree | dba122c2b78c8294bba96179d51e2ebcdbb3ddb5 /t/op/hexfp.t | |
parent | c86de4c07d8483411299c7c5d7d78f4fdaa4b225 (diff) | |
download | perl-7c6e7cf06853eef1d1b271077c402c5f8655fbe6.tar.gz |
avoid negative shift in scan_num()
Lengthy binaryish floating point literals used to perform illegal bit
shifts. Ignore digits that are past the end of the significand at an
earlier stage to avoid this. Code fix by Tony C. Fixes [perl #131894].
Diffstat (limited to 't/op/hexfp.t')
-rw-r--r-- | t/op/hexfp.t | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/op/hexfp.t b/t/op/hexfp.t index 29378f29af..e541cad30a 100644 --- a/t/op/hexfp.t +++ b/t/op/hexfp.t @@ -10,7 +10,7 @@ use strict; use Config; -plan(tests => 109); +plan(tests => 112); # Test hexfloat literals. @@ -255,6 +255,16 @@ SKIP: { is(0x1p-16445, 3.6451995318824746e-4951); } +# [perl #131894] parsing long binaryish floating point literals used to +# perform illegal bit shifts +SKIP: { + skip("non-64-bit NVs", 1) + unless $Config{nvsize} == 8 && $Config{d_double_style_ieee}; + is sprintf("%a", eval("0x030000000000000.1p0")), "0x1.8p+53"; + is sprintf("%a", eval("01400000000000000000.1p0")), "0x1.8p+54"; + is sprintf("%a", eval("0b110000000000000000000000000000000000000000000000000000000.1p0")), "0x1.8p+56"; +} + # sprintf %a/%A testing is done in sprintf2.t, # trickier than necessary because of long doubles, # and because looseness of the spec. |