-
Notifications
You must be signed in to change notification settings - Fork 576
writing to magic variables connected to the selected output GV when its IO object has been cleared crashes perl #20733
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
Comments
Rewritten slightly for quotation marks as:
In all cases, confirmed on FreeBSD-12 at both perl-5.32 and blead. Output:
|
On Sun, 22 Jan 2023, 05:48 a-shvedov, ***@***.***> wrote:
Binary builded without Asan instrumented flags. Would it be necessary to
add a asanlog file?
No, thanks for offering. We have reproducible case, anything else can be
done by whomever picks up this bug.
If you felt like accelerating the debugging of this or wanted to try your
hand at a fix you could building a debugging perl, run the cases under gdb
and get a stack trace of what blew up.
Yves
… |
You're creating a pointer to something (pack 'P') then swapping the byte order of the pointer, and trying to access what it refers to. The P/p pack/unpack template characters are very low level, you can't blindly use them and expect a sane result. If you have a specific case where you expect some behaviour from these template characters and don't get it, please provide all the details, not just a "this crashes". You can assume unpack "P" or "p" crashes by default.
This is a real problem, and applies to other magic variables when *STDOUT has been cleared:
|
pp_select() ensures that the GV in PL_defoutgv has an IO object when it the default output is set, but can't prevent that GV being cleared afterwards, resulting in a seg fault when the variable is written. To prevent this, check PL_defoutgv has an IO object before trying to write to it. Fixes Perl#20733
pp_select() ensures that the GV in PL_defoutgv has an IO object when it the default output is set, but can't prevent that GV being cleared afterwards, resulting in a seg fault when the variable is written. To prevent this, check PL_defoutgv has an IO object before trying to write to it. Fixes #20733
pp_select() ensures that the GV in PL_defoutgv has an IO object when it the default output is set, but can't prevent that GV being cleared afterwards, resulting in a seg fault when the variable is written. To prevent this, check PL_defoutgv has an IO object before trying to write to it. Fixes #20733 (cherry picked from commit af62106)
pp_select() ensures that the GV in PL_defoutgv has an IO object when it the default output is set, but can't prevent that GV being cleared afterwards, resulting in a seg fault when the variable is written. To prevent this, check PL_defoutgv has an IO object before trying to write to it. Fixes Perl#20733
pp_select() ensures that the GV in PL_defoutgv has an IO object when it the default output is set, but can't prevent that GV being cleared afterwards, resulting in a seg fault when the variable is written. To prevent this, check PL_defoutgv has an IO object before trying to write to it. Fixes Perl#20733
pp_select() ensures that the GV in PL_defoutgv has an IO object when it the default output is set, but can't prevent that GV being cleared afterwards, resulting in a seg fault when the variable is written. To prevent this, check PL_defoutgv has an IO object before trying to write to it. Fixes Perl#20733
Description
Tested at 5.15.78-2.el7.3.x86_64 (RED OS release MUROM 7.3.2 - Centos based system), but also reproduced this bug on other platforms x86_64.
Steps to Reproduce
Fonded several examples were found using endless recursion and causing falls.
Insert this string and run with
perl -e
or run string from file.Expected behavior
Is it correct that the interpreter does not processing such samples (even with the flag
-w
) and just calling SEGFAULT when trying to address the memory areas inaccessible to recording?Perl configuration
The text was updated successfully, but these errors were encountered: