diff options
author | Tony Cook <tony@develop-help.com> | 2017-08-14 15:10:22 +1000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-06 22:07:56 +0000 |
commit | 6c4f4eb174d1e2e9f874786123a699d11ae741f9 (patch) | |
tree | de2544f5117da6cd940129439c791427e1fb384c /regcomp.c | |
parent | 1af9149031d9f5d2d43b6df59b628a0f2c1041f6 (diff) | |
download | perl-6c4f4eb174d1e2e9f874786123a699d11ae741f9.tar.gz |
prevent integer overflow when compiling a regexp
Fixes [perl #131893].
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -5941,8 +5941,12 @@ Perl_re_printf( aTHX_ "LHS=%" UVuf " RHS=%" UVuf "\n", data->cur_is_floating = 1; /* float */ } min += min1; - if (delta != SSize_t_MAX) - delta += max1 - min1; + if (delta != SSize_t_MAX) { + if (SSize_t_MAX - (max1 - min1) >= delta) + delta += max1 - min1; + else + delta = SSize_t_MAX; + } if (flags & SCF_DO_STCLASS_OR) { ssc_or(pRExC_state, data->start_class, (regnode_charclass *) &accum); if (min1) { |