-
Notifications
You must be signed in to change notification settings - Fork 577
fwrite will segfault if stream is null #10221
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
From [email protected]This is a bug report for perl from cebratcher@gmail.com, The following works (but does not print "bar") in perlio. But will perl -le 'print "foo"; binmode ":pop"; binmode ":pop"; print "bar";' This appears to've been a bug as far back as 5.8.0. -Clif Flags: Site configuration information for perl 5.11.5: Configured by cbratcher at Mon Feb 22 19:03:59 EST 2010. Summary of my perl5 (revision 5 version 11 subversion 5) configuration: Locally applied patches: @INC for perl 5.11.5: Environment for perl 5.11.5: Flags: Site configuration information for perl 5.11.5: Configured by cbratcher at Mon Feb 22 19:03:59 EST 2010. Summary of my perl5 (revision 5 version 11 subversion 5) configuration: Locally applied patches: @INC for perl 5.11.5: Environment for perl 5.11.5: Flags: Site configuration information for perl 5.11.5: Configured by cbratcher at Mon Feb 22 19:03:59 EST 2010. Summary of my perl5 (revision 5 version 11 subversion 5) configuration: Locally applied patches: @INC for perl 5.11.5: Environment for perl 5.11.5: |
[email protected] - Status changed from 'new' to 'open' |
From [email protected]Check for valid IO and flip the err to EBADF if there's a problem in |
From [email protected]perlio_fwrite.patchcommit 2d0df07e7da6b2743477d99e63afd55c42945566
Author: Clif Bratcher <[email protected]>
Date: Tue Mar 9 17:55:12 2010 -0500
Bug 73474 - fwrite happily segfaults with a null stream
diff --git a/perlio.c b/perlio.c
index ddcc357..603be7b 100644
--- a/perlio.c
+++ b/perlio.c
@@ -3303,6 +3303,12 @@ PerlIOStdio_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
{
dVAR;
SSize_t got;
+
+ if (!PerlIOValid(f)) {
+ SETERRNO(EBADF, SS_IVCHAN);
+ return 0;
+ }
+
for (;;) {
got = PerlSIO_fwrite(vbuf, 1, count,
PerlIOSelf(f, PerlIOStdio)->stdio);
|
From @doyI can't reproduce this with any version of perl, going back to 5.8.1. -doy |
From @LeontOn Tue Mar 09 15:42:51 2010, cbratcher wrote:
That code is binmoding the filehandle *{":pop"}, instead of STDOUT as The same code using binmode STDOUT, ":pop" doesn't segfault for me on Leon |
From @jkeenanOn Thu Jul 05 04:28:12 2012, LeonT wrote:
Leon, Neither the original poster nor anyone else has responded to your post Thank you very much. |
From [email protected]Woah, I'd all but forgotten about this! Apologies for never following Just tried to reproduce the issue and I'm not seeing it in 5.12. Feel Thanks and sorry again, On Sat, Jun 29, 2013 at 8:28 PM, James E Keenan via RT
|
@cpansprout - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#73474 (status was 'resolved')
Searchable as RT73474$
The text was updated successfully, but these errors were encountered: