Bug 720610 - [PATCH] large string repeat count causes heap corruption
Summary: [PATCH] large string repeat count causes heap corruption
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: perl
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Pisar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-12 09:20 UTC by Jim Meyering
Modified: 2013-03-13 20:40 UTC (History)
9 users (show)

Fixed In Version: perl-5.12.4-148.fc14
Clone Of:
: 720644 720652 (view as bug list)
Environment:
Last Closed: 2011-11-13 05:36:03 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
proposed patch (2.28 KB, patch)
2011-07-12 09:20 UTC, Jim Meyering
no flags Details | Diff
Patch for Perl 5.14.2 (2.46 KB, patch)
2011-10-06 15:50 UTC, Petr Pisar
no flags Details | Diff

Description Jim Meyering 2011-07-12 09:20:49 UTC
Created attachment 512377 [details]
proposed patch

Description of problem: string repeat count > 2^31 causes heap corruption

Version-Release number of selected component (if applicable):
perl-5.12.4-159.fc15.x86_64

How reproducible: every time

Steps to Reproduce:
1. perl -le 'print "v"x(2**31+1)'
2.
3.
  
Actual results:
segfault

Expected results:
2^31+1 'v's followed by a newline on output

Additional info:
    http://thread.gmane.org/gmane.comp.lang.perl.perl5.porters/96812
    https://rt.perl.org/rt3/Ticket/Display.html?id=94560

Patch attached.

Comment 1 Petr Pisar 2011-07-12 11:13:31 UTC
F14 (perl-5.12.3-143.fc14.x86_64) affected too.

Comment 2 Petr Pisar 2011-10-06 10:48:43 UTC
Am I right this changes public API, thus without rebuilding all perl packages we cannot apply it?

Comment 3 Iain Arnell 2011-10-06 12:52:01 UTC
I made a very quick test in rawhide. After applying this patch and rebuilding perl-5.14.2, I downloaded a few XS dists at random and ran their test suites against the our existing packaged version with no failures.

I don't know of any modules actually using repeatcpy, nor do I have a local cpan to grep for one.

Comment 4 Jim Meyering 2011-10-06 13:04:21 UTC
Looking through matches from here,

https://codesearch.google.com/#search/&q=repeatcpy%5B%5E%7C%5D&p=1&type=cs

I found only one use:

Regexp-Fields-0.046/sources/regcomp-5.6.1.c
  1094: SvGROW(last_str, (mincount * l) + 1);
  1095: repeatcpy(SvPVX(last_str) + l,
  1096:           SvPVX(last_str), l, mincount - 1);

Comment 5 Petr Pisar 2011-10-06 13:38:16 UTC
Ok, I'll commit it into all branches with your IV type which is signed as well as original I32.

Comment 6 Petr Pisar 2011-10-06 15:50:49 UTC
Created attachment 526740 [details]
Patch for Perl 5.14.2

This patch for 5.14.2 modifies embed.fnc instead of proto.h as the later one is generated from the first one (by regen.pl script in root of Perl sources). Otherwise standard test t/porting/regen.t fails.

Comment 7 Fedora Update System 2011-11-02 12:26:11 UTC
perl-5.14.2-189.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/perl-5.14.2-189.fc16

Comment 8 Fedora Update System 2011-11-02 17:54:06 UTC
Package perl-5.14.2-189.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing perl-5.14.2-189.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-15276
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2011-11-03 21:52:48 UTC
Package perl-5.14.2-190.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing perl-5.14.2-190.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-15276
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2011-11-04 15:41:09 UTC
perl-5.12.4-163.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/perl-5.12.4-163.fc15

Comment 11 Fedora Update System 2011-11-04 16:33:09 UTC
perl-5.12.4-148.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/perl-5.12.4-148.fc14

Comment 12 Fedora Update System 2011-11-13 05:36:03 UTC
perl-5.14.2-190.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2011-11-25 02:01:21 UTC
perl-5.12.4-163.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2011-11-25 02:08:35 UTC
perl-5.12.4-148.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.