summaryrefslogtreecommitdiff
path: root/ext/PerlIO-encoding
diff options
context:
space:
mode:
authorLeon Timmermans <fawaka@gmail.com>2018-01-04 19:56:03 +0100
committerLeon Timmermans <fawaka@gmail.com>2021-01-30 21:09:54 +0100
commit79a3675f89ea7d9d801c159a22ea1e1f8058e9c3 (patch)
tree9b09a05a51cbbb0c10760791bcdc2ca0f62bbc37 /ext/PerlIO-encoding
parent57092531ca2360776c3c5703068fcc2daa633a53 (diff)
downloadperl-79a3675f89ea7d9d801c159a22ea1e1f8058e9c3.tar.gz
Disallow coderef in $PerlIO::encoding::fallback
Encode allows one to pass a coderef instead of a set of flags to handle. This however doesn't allow one to pass STOP_AT_PARTIAL, which means it has always been buggy on buffer boundaries. With my new automatic STOP_AT_PARTIAL passing this would result in an unpredictable value. Instead we now disallow it in PerlIO::encoding.
Diffstat (limited to 'ext/PerlIO-encoding')
-rw-r--r--ext/PerlIO-encoding/encoding.xs2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/PerlIO-encoding/encoding.xs b/ext/PerlIO-encoding/encoding.xs
index 1db9eba81e..720808d87d 100644
--- a/ext/PerlIO-encoding/encoding.xs
+++ b/ext/PerlIO-encoding/encoding.xs
@@ -168,6 +168,8 @@ PerlIOEncode_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, PerlIO_funcs *
}
e->chk = newSVsv(get_sv("PerlIO::encoding::fallback", 0));
+ if (SvROK(e->chk))
+ Perl_croak(aTHX_ "PerlIO::encoding::fallback must be an integer");
SvUV_set(e->chk, SvUV(e->chk) | encode_stop_at_partial);
e->inEncodeCall = 0;