From a416f938f3c940d9b05462b85c6f9165a7200cf6 Mon Sep 17 00:00:00 2001 From: Alex Dowad Date: Thu, 5 Nov 2020 23:27:07 +0200 Subject: [PATCH] Treat non-ASCII characters as erroneous when converting ASCII text --- ext/mbstring/libmbfl/filters/mbfilter_ascii.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/mbstring/libmbfl/filters/mbfilter_ascii.c b/ext/mbstring/libmbfl/filters/mbfilter_ascii.c index 4e02c26aac8..e411d8a7073 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_ascii.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_ascii.c @@ -79,7 +79,12 @@ const struct mbfl_convert_vtbl vtbl_wchar_ascii = { */ int mbfl_filt_conv_ascii_wchar(int c, mbfl_convert_filter *filter) { - return (*filter->output_function)(c, filter->data); + if (c < 0x80) { + (*filter->output_function)(c, filter->data); + } else { + (*filter->output_function)(c | MBFL_WCSGROUP_THROUGH, filter->data); + } + return c; }