-
Notifications
You must be signed in to change notification settings - Fork 608
Avoid referencing uninitialized memory in PerlIOScalar_write #24063
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
base: blead
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ use strict; | |
| use Fcntl qw(SEEK_SET SEEK_CUR SEEK_END); # Not 0, 1, 2 everywhere. | ||
| use Errno qw(EACCES); | ||
|
|
||
| plan(128); | ||
| plan(129); | ||
|
|
||
| my $fh; | ||
| my $var = "aaa\n"; | ||
|
|
@@ -528,3 +528,11 @@ SKIP: | |
| select((select($fh), ++$|)[0]); | ||
| ok(!(print $fh "x"), "write to a large offset"); | ||
| } | ||
|
|
||
| { # GH #24008 | ||
| open my $fh, '>', \my $str or BAIL_OUT $!; | ||
|
||
| print $fh "xxxxx"; | ||
| undef $str; | ||
| print $fh "y"; | ||
| is($str, "\0\0\0\0\0y", "write to undef'ed variable"); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is strange, the else should be at the same level as the if to match our common usage, see the if/else starting line 1274 for example.
I think the conditional sv_force_normal() above your change is now redundant, since all paths now either force_normal (SvPV_force*()) or set an explicit value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be due to GitHub's diff rendering. The
if (SvOK(sv))line is indented with a single tab character (this came from the original source before this change), while other added lines are indented without tab characters (according to.editorconfig)..editorconfigalso specifiestab_width = 8and theelseline is indented with 8 spaces, so these lines should appear to be aligned.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would seem that is my fault. Before ec57fb9 this part of the code was in a separate module that hadn't been updated to the "new" core style standard, and I didn't notice I should have fixed the indentation in that process.
I would suggest we follow up with a commit that fixes all the tabs to spaces.