-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Freeing $a or $b during sort causes a double free #11422
Comments
From @cpansprout$ perl5.14.0 -e '@_ = sort { *a = \1 } 1, 2' I think pp_sort is misusing SAVESPTR. Flags: Site configuration information for perl 5.14.0: Configured by sprout at Wed May 11 13:45:58 PDT 2011. Summary of my perl5 (revision 5 version 14 subversion 0) configuration: Locally applied patches: @INC for perl 5.14.0: Environment for perl 5.14.0: |
From @cpansproutOn Sun Jun 05 15:51:34 2011, sprout wrote:
Attached is a test case. I don’t know how to fix this efficiently. Making them reference-counted is the obvious fix, but I presume it was -- Father Chrysostomos |
From @cpansproutInline Patchdiff --git a/t/op/sort.t b/t/op/sort.t
index 6dedeeb..5911810 100644
--- a/t/op/sort.t
+++ b/t/op/sort.t
@@ -6,7 +6,7 @@ BEGIN {
require 'test.pl';
}
use warnings;
-plan( tests => 171 );
+plan( tests => 172 );
# these shouldn't hang
{
@@ -960,3 +960,16 @@ is @x, 0, 'sort; returns empty list';
eval '{@x = sort} 1';
is $@, '', '{sort} does not die';
is @x, 0, '{sort} returns empty list';
+
+# [perl #92264] Freeing $a or $b during sort
+{
+ my $w;
+ local $SIG{__WARN__} = sub { warn shift; ++ $w };
+ eval {
+ for (1,2) {
+ @x = sort { *a = \1; 1 } 1, 2;
+ @x = sort { *b = \1; 1 } 1, 2;
+ }
+ };
+ is $@, "", 'freeing $a or $b inside sort block';
+} |
From [Unknown Contact. See original ticket]On Sun Jun 05 15:51:34 2011, sprout wrote:
Attached is a test case. I don’t know how to fix this efficiently. Making them reference-counted is the obvious fix, but I presume it was -- Father Chrysostomos |
@cpansprout - Status changed from 'new' to 'open' |
From @cpansproutOn Sat Jan 14 22:53:05 2012, sprout wrote:
But incrementing and decrementing a reference count should not be too So, this being rare enough, it should probably wait until the stack is -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Sat Jan 14 22:53:05 2012, sprout wrote:
But incrementing and decrementing a reference count should not be too So, this being rare enough, it should probably wait until the stack is -- Father Chrysostomos |
From zefram@fysh.orgThe original test case on this ticket stopped producing the freeing $ perl -le '() = sort { *a = \1 } 1, 2' -zefram |
From zefram@fysh.orgThis ticket has been misclassified as a stack-not-refcounted bug; it has The issue is that the GvSV slot in globs *is* reference counted, but Fixed in commit 16ada23. -zefram |
@xsawyerx - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#92264 (status was 'resolved')
Searchable as RT92264$
The text was updated successfully, but these errors were encountered: