Perl_sv_recode_to_utf8 shouldn't be returning SvPVX(sv) without
Nicholas Clark [Sat, 2 Oct 2004 21:49:15 +0000 (21:49 +0000)]
any check on whether it's valid.

p4raw-id: //depot/perl@23344

sv.c

diff --git a/sv.c b/sv.c
index 3a443a2..5f91731 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -12283,8 +12283,9 @@ Perl_sv_recode_to_utf8(pTHX_ SV *sv, SV *encoding)
        FREETMPS;
        LEAVE;
        SvUTF8_on(sv);
+       return SvPVX(sv);
     }
-    return SvPVX(sv);
+    return SvPOKp(sv) ? SvPVX(sv) : NULL;
 }
 
 /*