com php-src: SJIS-mac encoding conversion: Stop the carnage of innocent Unicode codepoints: ext/mbstring/libmbfl/filters/mbfilter_sji s_mac.c

From: Date: Wed, 11 Nov 2020 09:18:58 +0000
Subject: com php-src: SJIS-mac encoding conversion: Stop the carnage of innocent Unicode codepoints: ext/mbstring/libmbfl/filters/mbfilter_sji s_mac.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-114117@lists.php.net to get a copy of this message
Commit: b27a34c5a9ce1fa509fe30c141142c801ce3b6dd Author: Alex Dowad <alexinbeijing@gmail.com> Sat, 19 Sep 2020 15:16:51 +0200 Parents: 7f0e86b2dc02e85ad02ced9ed851c3fc5594d800 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b27a34c5a9ce1fa509fe30c141142c801ce3b6dd Log: SJIS-mac encoding conversion: Stop the carnage of innocent Unicode codepoints When converting Unicode to MacJapanese, some special sequences of Unicode codepoints are collapsed into a single SJIS character. When the implementation sees a codepoint which *might* begin such a sequence, it is cached and examined again after the next codepoint arrives. If it turns out that it wasn't one of the 'special' sequences, then a 'fallback' conversion table is consulted to convert the cached codepoint. Then we re-enter the regular conversion code to convert the immediately following codepoint. BUT, local variables need to be reinitialized properly when doing this! Because the locals weren't reinitialized, the sad result was that some codepoints would get chopped up into bit salad and emitted as something totally bogus (which might not even be valid SJIS-mac text at all). Changed paths: M ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c Diff: diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c index 5214c429983..78bf8e3671e 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c @@ -372,6 +372,7 @@ mbfl_filt_conv_wchar_sjis_mac(int c, mbfl_convert_filter *filter) if (s2 <= 0 || s1 == -1) { break; } + s1 = s2 = 0; case 0:

« previous php.cvs (#114117) next »