diff options
author | Leon Timmermans <fawaka@gmail.com> | 2013-09-07 08:58:18 +0200 |
---|---|---|
committer | Leon Timmermans <fawaka@gmail.com> | 2013-09-07 09:01:42 +0200 |
commit | df8c7dee25da69fc88678b8949166e08fb686037 (patch) | |
tree | 8baedebddcab7691688e5439823133baa767a737 | |
parent | 7b6e8075e45ebc684565efbe3ce7b70435f20c79 (diff) | |
download | perl-df8c7dee25da69fc88678b8949166e08fb686037.tar.gz |
Fix segfault in filehandle duplication
Previously PerlIOBase_dup didn't check if pushing the new layer succeeded
before (optionally) setting the utf8 flag. This could cause
segfaults-by-nullpointer.
-rw-r--r-- | perlio.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2309,7 +2309,7 @@ PerlIOBase_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags) if (self && self->Getarg) arg = (*self->Getarg)(aTHX_ o, param, flags); f = PerlIO_push(aTHX_ f, self, PerlIO_modestr(o,buf), arg); - if (PerlIOBase(o)->flags & PERLIO_F_UTF8) + if (f && PerlIOBase(o)->flags & PERLIO_F_UTF8) PerlIOBase(f)->flags |= PERLIO_F_UTF8; SvREFCNT_dec(arg); } |