Branch: refs/heads/blead
Home: https://github.com/Perl/perl5
Commit: 10479682983ec87385921d8e144f2edb1676fc9f
https://github.com/Perl/perl5/commit/10479682983ec87385921d8e144f2edb1676fc9f
Author: TAKAI Kousuke <[email protected]>
Date: 2026-02-02 (Mon, 02 Feb 2026)
Changed paths:
M perlio.c
M pod/perldelta.pod
M t/io/scalar.t
Log Message:
-----------
PerlIOScalar_write: avoid SvCUR() on an undefined scalar
Once a scalar variable is undef'ed, its SvCUR might remain the previous
value. Using SvCUR() blindly might bypass the code that world normally
clear out the leading bytes and result as garbage (uninitialized) bytes
when the target scalar once held a non-empty string and then undef'ed.
So only call SvCUR() when the SV is defined.
t/io/scalar.t: added a test for this.
Thanks to the comment from @jkeenan for improving the test.
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications