From a1e27170fc118bb226e97988b42fb9a970689740 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Tue, 11 Aug 2015 15:49:37 +1000 Subject: [PATCH] [perl #125781] handle range overflow when Size_t is smaller than IV --- pp_ctl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pp_ctl.c b/pp_ctl.c index 5b58f47..50db9a8 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1206,7 +1206,11 @@ PP(pp_flop) /* The wraparound of signed integers is undefined * behavior, but here we aim for count >=1, and * negative count is just wrong. */ - if (n < 1) + if (n < 1 +#if IVSIZE > Size_t_size + || n > SSize_t_MAX +#endif + ) overflow = TRUE; } if (overflow) -- 1.8.3.1