In perl.git, the branch maint-5.26 has been updated <http://perl5.git.perl.org/perl.git/commitdiff/2a4a5f792f8e98c9d63fd49b328c0d0bd59a9f8c?hp=9507312411bd58a8aa4b54dc1d47e9285ce81232>
- Log ----------------------------------------------------------------- commit 2a4a5f792f8e98c9d63fd49b328c0d0bd59a9f8c Author: Steve Hay <[email protected]> Date: Sun Sep 10 15:06:12 2017 +0100 Finalize perldelta M pod/perldelta.pod commit dabae8f303c9dc4f5ccecf9705e9ef32fd578daf Author: Steve Hay <[email protected]> Date: Sun Sep 10 13:18:50 2017 +0100 perldelta for 96c83ed78a, 2be4edede4 and 8586647e33 (cherry picked from commit d1107db027ad52d2f50e348218625a8e122ca9eb) M pod/perldelta.pod commit ac0e1777b3dc4b535bd7a4d64ce5076ad5007ac4 Author: Tony Cook <[email protected]> Date: Thu Jul 27 10:12:02 2017 +1000 (perl #131665) avoid a buffer overflow in a buffer we didn't need since Lookup() treats its argument as NUL or '=' terminated. Previously environment variable names longer than the size of the buffer would result in a buffer overflow. (cherry picked from commit 8586647e338e8eb42c00fe6f687105c9b8a36d44) M t/win32/runenv.t M win32/perlhost.h commit 2692dda97731c37082a0075eff50d741901c665f Author: Karl Williamson <[email protected]> Date: Fri Aug 25 11:33:58 2017 -0600 PATCH: [perl #131598] The cause of this is that the vFAIL macro uses RExC_parse, and that variable has just been changed in preparation for code after the vFAIL. The solution is to not change RExC_parse until after the vFAIL. This is a case where the macro hides stuff that can bite you. (cherry picked from commit 2be4edede4ae226e2eebd4eff28cedd2041f300f) M regcomp.c commit 66288bb3f44c8aa5122e5f40d8cfc0eada8b1695 Author: Karl Williamson <[email protected]> Date: Wed Jun 21 11:33:37 2017 -0600 regcomp [perl #131582] (cherry picked from commit 96c83ed78aeea1a0496dd2b2d935869a822dc8a5) M regcomp.c ----------------------------------------------------------------------- Summary of changes: pod/perldelta.pod | 51 +++++++++++++++++++++++++++++++++++++++++++++------ regcomp.c | 7 +++++-- t/win32/runenv.t | 21 ++++++++++++++++----- win32/perlhost.h | 10 ++-------- 4 files changed, 68 insertions(+), 21 deletions(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index a5ac950c69..d47cca829a 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -14,11 +14,25 @@ L<perl5260delta>, which describes differences between 5.24.0 and 5.26.0. =head1 Security -XXX Any security-related notices go here. In particular, any security -vulnerabilities closed should be noted here rather than in the -L</Selected Bug Fixes> section. +=head2 [CVE-2017-12837] Heap buffer overflow in regular expression compiler -[ List each security issue as a =head2 entry ] +Compiling certain regular expression patterns with the case-insensitive +modifier could cause a heap buffer overflow and crash perl. This has now been +fixed. +L<[perl #131582]|https://rt.perl.org/Public/Bug/Display.html?id=131582> + +=head2 [CVE-2017-12883] Buffer over-read in regular expression parser + +For certain types of syntax error in a regular expression pattern, the error +message could either contain the contents of a random, possibly large, chunk of +memory, or could crash perl. This has now been fixed. +L<[perl #131598]|https://rt.perl.org/Public/Bug/Display.html?id=131598> + +=head2 [CVE-2017-12814] C<$ENV{$key}> stack buffer overflow on Windows + +A possible stack buffer overflow in the C<%ENV> code on Windows has been fixed +by removing the buffer completely since it was superfluous anyway. +L<[perl #131665]|https://rt.perl.org/Public/Bug/Display.html?id=131665> =head1 Incompatible Changes @@ -165,9 +179,34 @@ L<[perl #131522]|https://rt.perl.org/Public/Bug/Display.html?id=131522> =head1 Acknowledgements -XXX Generate this with: +Perl 5.26.1 represents approximately 3 months of development since Perl 5.26.0 +and contains approximately 8,800 lines of changes across 84 files from 21 +authors. + +Excluding auto-generated files, documentation and release tools, there were +approximately 960 lines of changes to 38 .pm, .t, .c and .h files. + +Perl continues to flourish into its third decade thanks to a vibrant community +of users and developers. The following people are known to have contributed +the improvements that became Perl 5.26.1: + +Aaron Crane, Andy Dougherty, Aristotle Pagaltzis, Chris 'BinGOs' Williams, +Craig A. Berry, Dagfinn Ilmari Mannsåker, David Mitchell, E. Choroba, Eric +Herman, Father Chrysostomos, Jacques Germishuys, James E Keenan, Karl +Williamson, Lukas Mai, Matthew Horsfall, Ricardo Signes, Sawyer X, Steve Hay, +Tony Cook, Yves Orton, Zefram. + +The list above is almost certainly incomplete as it is automatically generated +from version control history. In particular, it does not include the names of +the (very much appreciated) contributors who reported issues to the Perl bug +tracker. + +Many of the changes included in this version originated in the CPAN modules +included in Perl's core. We're grateful to the entire CPAN community for +helping Perl to flourish. - perl Porting/acknowledgements.pl v5.26.1..HEAD +For a more complete list of all of Perl's historical contributors, please see +the F<AUTHORS> file in the Perl source distribution. =head1 Reporting Bugs diff --git a/regcomp.c b/regcomp.c index 5d9930c61b..b2de7f05e1 100644 --- a/regcomp.c +++ b/regcomp.c @@ -12159,14 +12159,16 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state, } sv_catpv(substitute_parse, ")"); - RExC_parse = RExC_start = RExC_adjusted_start = SvPV(substitute_parse, - len); + len = SvCUR(substitute_parse); /* Don't allow empty number */ if (len < (STRLEN) 8) { RExC_parse = endbrace; vFAIL("Invalid hexadecimal number in \\N{U+...}"); } + + RExC_parse = RExC_start = RExC_adjusted_start + = SvPV_nolen(substitute_parse); RExC_end = RExC_parse + len; /* The values are Unicode, and therefore not subject to recoding, but @@ -13229,6 +13231,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) goto loopdone; } p = RExC_parse; + RExC_parse = parse_start; if (ender > 0xff) { REQUIRE_UTF8(flagp); } diff --git a/t/win32/runenv.t b/t/win32/runenv.t index 514eda0c20..4746afaa4a 100644 --- a/t/win32/runenv.t +++ b/t/win32/runenv.t @@ -14,10 +14,10 @@ BEGIN { require Win32; ($::os_id, $::os_major) = ( Win32::GetOSVersion() )[ 4, 1 ]; if ($::os_id == 2 and $::os_major == 6) { # Vista, Server 2008 (incl R2), 7 - $::tests = 43; + $::tests = 45; } else { - $::tests = 40; + $::tests = 42; } require './test.pl'; @@ -70,11 +70,12 @@ sub runperl_and_capture { } sub try { - my ($env, $args, $stdout, $stderr) = @_; + my ($env, $args, $stdout, $stderr, $name) = @_; my ($actual_stdout, $actual_stderr) = runperl_and_capture($env, $args); + $name ||= ""; local $::Level = $::Level + 1; - is $actual_stdout, $stdout; - is $actual_stderr, $stderr; + is $actual_stdout, $stdout, "$name - stdout"; + is $actual_stderr, $stderr, "$name - stderr"; } # PERL5OPT Command-line options (switches). Switches in @@ -196,6 +197,16 @@ try({PERL5LIB => "foo", '', ''); +{ + # 131665 + # crashes without the fix + my $longname = "X" x 2048; + try({ $longname => 1 }, + [ '-e', '"print q/ok/"' ], + 'ok', '', + 'very long env var names' ); +} + # Tests for S_incpush_use_sep(): my @dump_inc = ('-e', '"print \"$_\n\" foreach @INC"'); diff --git a/win32/perlhost.h b/win32/perlhost.h index 84b08c9b90..3260f62a02 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -2177,17 +2177,11 @@ compare(const void *arg1, const void *arg2) void CPerlHost::Add(LPCSTR lpStr) { - char szBuffer[1024]; LPSTR *lpPtr; - int index, length = strlen(lpStr)+1; - - for(index = 0; lpStr[index] != '\0' && lpStr[index] != '='; ++index) - szBuffer[index] = lpStr[index]; - - szBuffer[index] = '\0'; + STRLEN length = strlen(lpStr)+1; // replacing ? - lpPtr = Lookup(szBuffer); + lpPtr = Lookup(lpStr); if (lpPtr != NULL) { // must allocate things via host memory allocation functions // rather than perl's Renew() et al, as the perl interpreter -- Perl5 Master Repository
